IT lexicon Programming XOR

XOR Exclusive OR

Programming På svenska → Updated: 2026-05-24

Boolean operator: true if exactly one input is true. Symbol: ⊕, ^. Peculiar property: A ⊕ B ⊕ B = A — its own inverse.

Foundation of symmetric encryption (one-time pad, stream ciphers — XOR with key stream). Diff/swap trick: a ^= b; b ^= a; a ^= b; swaps two variables without a temp. Hashing: XOR sum = simple parity check. CPUs have a dedicated XOR instruction, often faster than addition.

← Back to the lexicon