crypto101/book

Error at 5.2 "A Few Properties of XOR"?

Closed this issue · 1 comments

I have the most recent version of the PDF (commit 16e23a - 0.4.0-100-g16e23a4), and I believe there is in error at the end of 5.2 "A Few Properties of XOR" where it shows the XOR rules being applied in an example:

  1. You can apply XOR in any order: a ⊕ (b ⊕ c) = (a ⊕ b) ⊕ c
  2. You can flip the operands around: a ⊕ b = b ⊕ a
  3. Any bit XOR itself is 0: a ⊕ a = 0. If a is 0, then it’s 0 ⊕ 0 = 0;
    if a is 1, then it’s 1 ⊕ 1 = 0.
  4. Any bit XOR 0 is that bit again: a ⊕ 0 = a. If a is 0, then it’s
    0 ⊕ 0 = 0; if a is 1, then it’s 1 ⊕ 0 = 1.

These rules also imply a ⊕ b ⊕ a = b:
a ⊕ b ⊕ a = a ⊕ a ⊕ b (first rule)
= 0 ⊕ b (second rule)
= b (third rule)

It seems the rules listed next to the steps are off by one. Shouldn't it be like the following?

These rules also imply a ⊕ b ⊕ a = b:
a ⊕ b ⊕ a = a ⊕ a ⊕ b (second rule)
= 0 ⊕ b (third rule)
= b (fourth rule)

lvh commented

You're right! This bug got introduced in a recent change. I'll fix it. Thanks for submitting!