Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. The Lounge
  3. while (*s++ = ((*t & 0x60) == 0x40 ? *t ^ 0x20 : *t)) t++;

while (*s++ = ((*t & 0x60) == 0x40 ? *t ^ 0x20 : *t)) t++;

Scheduled Pinned Locked Moved The Lounge
rubyquestion
40 Posts 27 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • realJSOPR realJSOP

    Well, you're right, but why would anyone want to do a bitwise XOR on a character in a string. Is this some sort of half-assed encryption thing, or maybe converting a string from Base64 characters to ascii?

    .45 ACP - because shooting twice is just silly
    -----
    "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997
    -----
    "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001

    R Offline
    R Offline
    Rob Philpott
    wrote on last edited by
    #10

    ..just for fun really. It's nearly the weekend..

    Regards, Rob Philpott.

    D 1 Reply Last reply
    0
    • R Rob Philpott

      Bingo!, Well done.

      Regards, Rob Philpott.

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #11

      Yay :)

      1 Reply Last reply
      0
      • R Rob Philpott

        It's turning into one of 'those' Friday afternoons. Any takers for what this gem does?

        Regards, Rob Philpott.

        E Offline
        E Offline
        Ennis Ray Lynch Jr
        wrote on last edited by
        #12

        Removes sql injection?

        Need custom software developed? I do custom programming based primarily on MS tools with an emphasis on C# development and consulting. I also do Android Programming as I find it a refreshing break from the MS. "And they, since they Were not the one dead, turned to their affairs" -- Robert Frost

        1 Reply Last reply
        0
        • P Pete OHanlon

          Rob Philpott wrote:

          Any takers for what this gem does?

          Why that's obvious. It makes you hate the coder who spewed it into your source.

          I have CDO, it's OCD with the letters in the right order; just as they ruddy well should be

          My blog | My articles | MoXAML PowerToys | Onyx

          R Offline
          R Offline
          Rob Philpott
          wrote on last edited by
          #13

          Pete O'Hanlon wrote:

          It makes you hate the coder who spewed it into your source.

          Yeah, that was me. Only for the sake of being cryptic though, although I'm starting to think we need more code like that these days. Beats 'design patterns'.

          Regards, Rob Philpott.

          1 Reply Last reply
          0
          • L Lost User

            It turns a string to lower case? edit: that is, it copies a string to s as lower case (but I'm still not actually sure)

            N Offline
            N Offline
            NormDroid
            wrote on last edited by
            #14

            *t ^ 0x20 maybe upper

            Two heads are better than one.

            L 1 Reply Last reply
            0
            • R Rob Philpott

              Bingo!, Well done.

              Regards, Rob Philpott.

              N Offline
              N Offline
              NormDroid
              wrote on last edited by
              #15

              I just had the debugger out, cranking it through.

              Two heads are better than one.

              1 Reply Last reply
              0
              • N NormDroid

                *t ^ 0x20 maybe upper

                Two heads are better than one.

                L Offline
                L Offline
                Lost User
                wrote on last edited by
                #16

                But it only xors with 0x20 if it's already upper case (or a non-ascii char between 0xC0 and 0xDF) Undeserved 2-vote.

                modified on Monday, August 30, 2010 12:28 PM

                1 Reply Last reply
                0
                • L Lost User

                  It turns a string to lower case? edit: that is, it copies a string to s as lower case (but I'm still not actually sure)

                  P Offline
                  P Offline
                  peterchen
                  wrote on last edited by
                  #17

                  someone who knows his ASCII :)

                  Agh! Reality! My Archnemesis![^]
                  | FoldWithUs! | sighist | WhoIncludes - Analyzing C++ include file hierarchy

                  L 1 Reply Last reply
                  0
                  • P peterchen

                    someone who knows his ASCII :)

                    Agh! Reality! My Archnemesis![^]
                    | FoldWithUs! | sighist | WhoIncludes - Analyzing C++ include file hierarchy

                    L Offline
                    L Offline
                    Lost User
                    wrote on last edited by
                    #18

                    Well, to be honest, I did take a look at the ASCII table.. before that I wasn't sure enough of my answer to post it Undeserved 1-vote.

                    modified on Monday, August 30, 2010 12:28 PM

                    1 Reply Last reply
                    0
                    • R Rob Philpott

                      It's turning into one of 'those' Friday afternoons. Any takers for what this gem does?

                      Regards, Rob Philpott.

                      M Offline
                      M Offline
                      Member 96
                      wrote on last edited by
                      #19

                      Cause a developer to get fired? Or at least a stern talking to?


                      Yesterday they said today was tomorrow but today they know better. - Poul Anderson

                      P 1 Reply Last reply
                      0
                      • R Rob Philpott

                        It's turning into one of 'those' Friday afternoons. Any takers for what this gem does?

                        Regards, Rob Philpott.

                        J Offline
                        J Offline
                        Jonas Hammarberg
                        wrote on last edited by
                        #20

                        Copying string, turning upper case into lower case...

                        R 1 Reply Last reply
                        0
                        • R Rob Philpott

                          It's turning into one of 'those' Friday afternoons. Any takers for what this gem does?

                          Regards, Rob Philpott.

                          H Offline
                          H Offline
                          hdjim
                          wrote on last edited by
                          #21

                          increment the address of s set the value of s to the value of t and increment t. the value of t is dependent on the if statement. AND the value of t with 0x60 and if bit 6 is set, make the value of s = the value of t exclusive ored with 32,otherwise set s to the value of t... then increment the address of t. do this until the value of s is not true.

                          modified on Monday, August 30, 2010 9:33 AM

                          1 Reply Last reply
                          0
                          • R Rob Philpott

                            It's turning into one of 'those' Friday afternoons. Any takers for what this gem does?

                            Regards, Rob Philpott.

                            E Offline
                            E Offline
                            ehoagland66
                            wrote on last edited by
                            #22

                            I used to write my code like this until my boss beat me with stick and took my coffee cup :laugh:

                            A 1 Reply Last reply
                            0
                            • M Member 96

                              Cause a developer to get fired? Or at least a stern talking to?


                              Yesterday they said today was tomorrow but today they know better. - Poul Anderson

                              P Offline
                              P Offline
                              philcaetano
                              wrote on last edited by
                              #23

                              Trying to figure this out, will causes someone to lose more productive than the multi-monitor/multi-tasking debate. ;P

                              1 Reply Last reply
                              0
                              • E ehoagland66

                                I used to write my code like this until my boss beat me with stick and took my coffee cup :laugh:

                                A Offline
                                A Offline
                                Andreas Mertens
                                wrote on last edited by
                                #24

                                I remember using this technique for an assembly program I wrote many years ago. When I worked out what it was doing, it took a moment to realize why it look familiar... Andreas Mertens

                                1 Reply Last reply
                                0
                                • L Lost User

                                  It turns a string to lower case? edit: that is, it copies a string to s as lower case (but I'm still not actually sure)

                                  L Offline
                                  L Offline
                                  Larry G Grimes
                                  wrote on last edited by
                                  #25

                                  It definitely returns a string with all lowercase characters.

                                  M 1 Reply Last reply
                                  0
                                  • R Rob Philpott

                                    It's turning into one of 'those' Friday afternoons. Any takers for what this gem does?

                                    Regards, Rob Philpott.

                                    M Offline
                                    M Offline
                                    M i s t e r L i s t e r
                                    wrote on last edited by
                                    #26

                                    wastes a lot of peoples time on this site ?

                                    1 Reply Last reply
                                    0
                                    • R Rob Philpott

                                      It's turning into one of 'those' Friday afternoons. Any takers for what this gem does?

                                      Regards, Rob Philpott.

                                      T Offline
                                      T Offline
                                      tom1443
                                      wrote on last edited by
                                      #27

                                      This looks like an job interview question, in which case I don't want the job.

                                      1 Reply Last reply
                                      0
                                      • R Rob Philpott

                                        It's turning into one of 'those' Friday afternoons. Any takers for what this gem does?

                                        Regards, Rob Philpott.

                                        P Offline
                                        P Offline
                                        PHLIPH
                                        wrote on last edited by
                                        #28

                                        Yeah, converts to lower case is right - but don't forget it also does '@' => '`', '[' => '{', '\' => '|', ']' => '}', '^' => '-', and '_' => del. Just felt the need to punctuate it. :)

                                        1 Reply Last reply
                                        0
                                        • R Rob Philpott

                                          It's turning into one of 'those' Friday afternoons. Any takers for what this gem does?

                                          Regards, Rob Philpott.

                                          N Offline
                                          N Offline
                                          neil hudson
                                          wrote on last edited by
                                          #29

                                          It corrupts strings with @ [ \ ] ^ and _ in them.

                                          Neil Hudson

                                          1 Reply Last reply
                                          0
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          • Login

                                          • Don't have an account? Register

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular
                                          • World
                                          • Users
                                          • Groups