Bitwise XOR

Bit-by-bit operation

Each column is independent. Bits that differ produce 1; bits that match produce 0.

AB=

Summary

A
B
A ⊕ B

Truth table

In cryptography

One-time pad demo

XOR each byte of a message with the matching byte of a key. The ciphertext is unbreakable if the key is truly random and never reused — that's the one-time pad. XOR the ciphertext with the same key to recover the original.