XOR
stands for exclusive-or,
a less familiar operation unless you are already
a seasoned programmer or logician.
XOR
is usually
denoted by the symbol ⊕
.
\( x \oplus y \) is True
only if just
one of \( x \) and \( y \) is True
.
Its table is like the ADD
table, but with a different twist than with OR
.
⊕| 0 1 ---+------- 0| 0 1 1| 1 0
XOR
applied to two bytes is applied bit by bit.
Here is the XOR
of two data bytes.
01100100 ⊕ 00111101 ------------ 01011001
If the usefulness of XOR
isn't obvious, we can
define binary addition in terms of logical operations.
x + y ---- ab a = x ∧ y b = x ⊕ y