# Are all binary-additive stream ciphers reciprocal?

I'm writing a thesis focused on Maurer's provably-secure stream cipher. Long story short, this cipher works by expanding a short key into a long keystream and then XORring this keystream with the plaintext in order to obtain the ciphertext (and vicecersa).

Take this definition of a binary-additive stream cipher: a cipher where the plaintext, ciphertext and keystream are binary strings and where the ciphertext is produced as a XOR addition of the plaintext and the keystream.

Also, take this definition of a reciprocal cipher: a cipher in which the encryption and decryption algorithms are identical (they're the same involution).

With these two definitions, can I state that binary-additive stream ciphers are all reciprocal ciphers? I think so, since if the ciphertext is the XOR of plaintext and keystream, than the plaintext must be the XOR of the keystream and the ciphertext.

• The inverse of XOR is XOR, so yes. – mikeazo Nov 20 '14 at 18:49
• Yes, that's what I thought. Thank you for the quick response! – whatyouhide Nov 20 '14 at 18:52
• Note that this isn't the case for CFB mode, which is a xor based stream cipher but doesn't fulfill your particular definition. – CodesInChaos Nov 20 '14 at 18:58
• @CodesInChaos I don't know what CFB mode is :(. If I understand correcly from Wikipedia, it's something that turns a cipher into a self-synchronizing (or asynchronous) stream cipher; binary-additive stream cipher are, by definition, synchronous stream cipher so I don't think that that would be a problem. Again, I'm not sure I'm getting this right :). – whatyouhide Nov 20 '14 at 19:03
• @whatyouhide: Welcome to crypto.SE! $\;$ Looks like you are doing fine; I do not spot that you wrote anything silly in question or comment. – fgrieu Nov 20 '14 at 20:15

Since additive stream ciphers are involutions, i.e., $$E_K(\cdot)=D_K(\cdot)$$ for all possible keys $K$, they are also reciprocal.