Why is XOR used in cryptography?

Viewed 43768

Why is only XOR used in cryptographic algorithms, and other logic gates like OR, AND, and NOR are not used?

13 Answers

XOR is a mathematical calculation in cryptography. It is a logical operation. There are other logical operations: AND, OR, NOT, Modulo Function etc. XOR is the most important and the most used.

enter image description here

If it's the same, it's 0.

If it's different, it's 1.

Example:

Message : Hello

Binary Version of Hello : 01001000 01100101 01101100 01101100 01101111

Key-stream : 110001101010001101011010110011010010010111

Cipher text using XOR : 10001110 11000110 00110110 10100001 01001010

Applications : The one-time pad/Vern-am Cipher uses the Exclusive or function in which the receiver has the same key-stream and receives the ciphertext over a covert transport channel. The receiver then Xor the ciphertext with the key-stream in order to reveal the plaintext of Hello. In One Time Pad, the key-stream should be at-least as long as the message.

Fact : The One Time Pad is the only truly unbreakable encryption.

Exclusive Or used in Feistel structure which is used in the block cipher DES algo.

Note : XOR operation has a 50% chance of outputting 0 or 1.

enter image description here

Related