Xoring alphabet letters with space character

Aryan Naraghi picture Aryan Naraghi · Mar 12, 2012 · Viewed 7k times · Source

Is there a historical reason as to why Xoring any alphabetic letter with the space character changes the case of the letter? (i.e., 'a' xor ' ' = 'A', 'F' xor ' ' = 'f', etc...)

Or is this just a coincidence?

(Assuming the characters are ASCII- or unicode-encoded.)

Answer

matthewk picture matthewk · Mar 12, 2012

I'm sure it was deliberate that the case could be changed by changing a single bit - it will have made early software much more efficient. The fact that the space character is #32 is irrelevant.