Exclusive disjunction
In logic, exclusive disjunction is a logical operator.
The exclusive disjunction of propositions A and B is called A xor B, where "xor" stands for "exclusive or".
The operation yields the result TRUE when one, and only one, of its operands is TRUE.
For two inputs A and B, the truth table of the function is as follows.
It can be deduced from this table that
The mathematical symbol for exclusive disjunction varies in the literature.
In addition to the abbreviation "xor", one may see
Binary values xor'ed by themselves are always zero.
In some computer architectures, it is faster to store a zero in a
register by xor'ing the value with itself instead of loading and storing
the value zero. Thus, on some computer architectures, xor'ing values
with themselves is a common optimization.
The xor operation is sometimes used as a simple mixing function in cryptography, for example, with one-time pad or Feistel network[?] systems.
A B | A xor B
----+--------
F F | F
F T | T
T F | T
T T | F
See also: or, and