Deciphering Single-Byte XOR Ciphertexts
arpitbhayani.me
arpitbhayani.me
But not as easy as binaries... I've seen a few binaries in the wild that were "protected" with XOR "encryption". Sure, you can go for the header and figure out the XOR constant that way. But no need to waste your time on that! Binaries are often full of long stretches of zeros... and guess what happens to those under XOR?
With XOR you've got 8 bits to correct, let's look at each in turn to see why my cheesy approach is enough on a chunk of likely ASCII or ASCII-compatible text:
0x80 the most significant bit - If this is wrong nothing will match because 0x80 isn't set in any of our matches
0x40 - If this is wrong digit zero and space won't match, upper case letters won't match, and lower case 'a' through 'o' plus 'z' won't match.
0x20 - If this is wrong space and numerals don't match. It also "flips" the case which means if you're just fishing for the plaintext and there were no spaces or numerals it's still easily readable.
0x10 - If this is wrong all numerals except zero don't match, and letters 'K' through 'O' in either case don't match
0x08 - If this is wrong space doesn't match. Digits 2 through 7, letters 'S' through 'W' in either case don't match
0x04 - If this is wrong space doesn't match. Digits 8 and 9 don't match. Letters 'X' through 'Z' in either case don't match.
0x02 - If this is wrong space doesn't match. Digits 8 and 9 again, and this time only the letter 'Y' (either case) doesn't match.
0x01 least significant - Only space doesn't match.
You can see that space is really doing a lot of work for you here, but on the other hand humans really like space. If the text you thought would be French poetry is actually Python it's likely still full of spaces even though the letter frequencies are way off.
It probably wouldn't make sense to automate anti-abuse-related posts, though, since then people would have a new vector through which to game them.
I have fond memories of that time, writing and decoding messages with school friends.
I have always assume that a lot of people first contact with criptography was that short story.
https://en.wikipedia.org/wiki/The_Adventure_of_the_Dancing_M...
I believe that Sendero Luminoso made the mistake of trusting to WordPerfect's encryption, and suffered for that after one or more of its computers were seized in a raid.
https://news.ycombinator.com/item?id=8166064
https://news.ycombinator.com/item?id=12720009
One comment in the first discussion is from a user stuck on the problem discussed in this blog post.