[Home][FAQ Details]

[Computer Stuff]

Encryption - Simple XOR

As we move into the land of Nod and computer programming, we discover techniques for encryption and decryption that are based on doing things with binary numbers. The Simple XOR code performs operations on the binary representations of numbers - which could, of course, represent characters. Some of these systems are touted as "almost as good" as RSA. And they often have 32 byte passwords that would take trillions of years to crack. While it is true that it would take an eternity to check every password, there are other ways to resolve the Simple XOR that can be accomplished in seconds on a computer.

XOR has the following properties:

  • myText xor myPassword=myCode
  • MyCode xor myPassword=myText

So the same algorithm can be used to crypt and decrypt our code. Simple XOR is the modern person's VignenĖre. It also has the following property:

myCode xor myText=myPassword

Demonstration of Simple XOR

The following code demonstrates using Simple XOR for encryption and decryption. The encoded text is in bytes.

Text to Encode (or Decoded Text)


Text to Decode (or Encoded Text)

The Simple XOR ciphertext is easy to unravel. According to Schneier, it can be achieved in seconds on a computer. The unauthorised decoder first determines the password length (perhaps using mathematical techniques) and then guesses a word in the text. The XOR has the property that when the coded text is XORed with the plain text, it reveals the password.

Plain Text xor Password=Cipher Text
Password=Cipher Text xor Plain Text

By XORing the cipher text with a guessed or know plain text, the password pops out, and the whole text can be deciphered.