XOR encryption |
|
XOR
The XOR OperatorXOR, also know as Exclusive OR, is a bitwise operator from
The six bitwise operators, as defined in the C programming language, are:
The XOR operator returns a 1 when the value of either the first bit or the second bit is a 1. The XOR operator returns a 0 when neither or both of the bits is 1. This is best illustrated in the following chart:
The XOR operator is used to "flip" bits (zeroes and ones) in a piece of plaintext to create a ciphertext. Converting Plaintext to Ciphertext with XOR EncryptionThe plaintext we will start with is the term "FAQ".
We will XOR the first character of this plaintext into ciphertext using a "V" as the key:
Converting Ciphertext to Plaintext with XOR EncryptionXOR encryption is a symmetric algorithm. This means that we can use the encryption key as the decryption key. Let's decrypt our ciphertext to recreate our original plaintext.
Do the math yourself with the other two characters of plaintext to prove this to yourself. Many encryption algorithms utilize the XOR operator as part of their operations. Understanding XOR and the other binary operators is a necessary step on the path to becoming a cryptologist. XOR SecurityXOR encryption is trivially simple to implement and equally trivial to break. XOR encryption should not be utilized for any data which you would want to protect. |
Discuss XOR encryption in the forums.

