Member-only story
The making of the XOR cipher
Mathematical proof that m ≡ ((m ⊕ k) ⊕ k) ≡ (c ⊕ k)

Contents at a glance
- Introduction
- The problem and a solution
- Proving the XOR cipher
- Final thoughts
- Acknowledgements
- Works cited
Introduction
Fellow InfoSec Write-ups contributor ofer shmueli recently published a fine introductory article discussing base64 encoding (Shmueli, 2021) and I recommend that people who are getting started in cybersecurity (or just ICT in general) have a look at it. In honour of Shmueli’s contribution, I figured that I would discuss a mathematical theorem and its proof that can give us confidence that the XOR cipher will always work.
The problem and a solution
For the majority of recorded history, mankind has always found itself needing to transmit written information from one party to another, without fear of some third party learning about the contents of it. Cryptography is a field that attempts to solve this problem by “transforming [information] into [a] form that unintended recipients cannot understand” (Fruhlinger, 2020). In the information age, the XOR cipher provided the basis for more…