# Exclusive-OR (XOR) CISSP Notes

Exclusive OR is a mathematical calculation in cryptography. It is a logical operation.

There are other logical operations in our CISSP study guides: AND, OR, NOT, Modulo Function etc. etc.

**XOR** though, is the **most important and the most used.**

And it's really easy to understand.

It consists of the multiplication of 1 and 0, that's it.

If it's 1 times 1, the result is 0.

If it's 0 times 0, the result is 0.

If it's a combination of 1 and a 0, the result is 1.

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

If it's different, it's 1.

**Example**

Our message:

Hello

Regular binary version of **Hello**:

01001000 01100101 01101100 01101100 01101111

Our secret **keystream**:

110001101010001101011010110011010010010111

To get the **ciphertext**, you **multiple the binary version of the message with the random keystream**.

**Hello** 01001000 01100101 01101100 01101100 01101111

**Keystream** 11000110 10100011 01011010 11001101 00100101

**Cipertext** 10001110 11000110 00110110 10100001 01001010

**Real Life Usages **

The one-time pad uses the Exclusive Or function. The receiver has a copy of the **keystream**, and receives the **ciphertext **over a covert transport channel. The receiver then XORs the **ciphertext **with the **keystream **in order to reveal the plaintext of **Hello**.

**Fun fact**: The one-time pad is considered the only truly unbreakable encryption algorithm.

The block cipher DES uses Exclusive Or.

Tags: