Dan Boneh's Crypto 1 Course includes a lesson on stream ciphers with the following slide:
He asks the question:
And the answer he gives is $m \oplus p$, which is why this is insecure.
But I don't see why this is correct.
- $m = 0011$
- $k = 1100$
- $p = 1010$
then $$m \oplus k = 1111$$
and $$(m \oplus k) \oplus p = 0101$$
and $$m \oplus p = 1001$$
so $$m \oplus p \neq ((m \oplus k) \oplus p)$$
What am I doing wrong in the above?