THE XOR CIPHER encrypt and decrypt are the SAME operation — c = m ⊕ k, m = c ⊕ k
The simplest cipher there is, and the seed of every stream cipher: XOR each bit of the message with a key bit. To decrypt, XOR again with the same key — because m ⊕ k ⊕ k = m, encryption is its own inverse. One circuit enciphers and deciphers; the key is the only secret. Alone with a short, reused key it is trivially broken, but combined with a truly random, one-time key it becomes the unbreakable one-time pad (dart 423). Here it is the door into the batch: a cipher that is a self-inverse, the corpus’s first axis worn as a lock.
THE TECHNIQUE c = m ⊕ k; m = c ⊕ k — the cipher is an involution
The demo enciphers a byte with a key, then runs the identical XOR to recover it — encrypt and decrypt are one operation: live demo
HISTORY & CREDIT XOR / Vernam-style stream cipher
“Decryption undoes encryption with a different key.” — not for XOR: the same key and the same operation both lock and unlock. cited
the identity · m ⊕ k ⊕ k = m — XOR is an involution, so cipher = decipher. the danger · reuse the key on two messages and c₁ ⊕ c₂ = m₁ ⊕ m₂ leaks (dart 434, the nonce). lineage · the additive/stream cipher; with a random one-time key it is the Vernam one-time pad (dart 423).
A lock whose key is its own undo — the self-inverse turned into a cipher. self-inverse
RECOMMEND FOR I-13 the involutive cipher, on the compiler
On the canonical compiler, msg 77 with key 42 enciphers to 103; the same XOR recovers 77 — encrypt is decrypt:
$ i13 run zd_xorcipher.i13 # c = m ^ k ; m = c ^ k
RUN OK · 45 step(s) · peak stack 4 · call depth 1
msg = 77 key = 42
ct = 103 -- 77 ^ 42
pt = 77 -- 103 ^ 42, recovered
self_inverse = 1 -- enc(enc(m,k),k) == m
Recommend as the batch’s opener — a NULL by duplication. The XOR cipher is a clean instance of the seated self-inverse axis (CRC/Verlet): encryption is an involution, m⊕k⊕k=m. It is keeper-shaped (a temp-storing cipher would not be self-inverse) but it duplicates axis 1 rather than opening a sixth. NULL. It sets the frame for the genuinely new bids later in the batch — the-secret-sharing and the-bloom-filter.