ITPEC FE Subject A October 2024 Question 28

Topic: Security

Which of the following bitwise logical operation can be applied in stream cipher between a plain-text and a keystream to produce a cipher-text, and between a ciphertext and the keystream to recover the plaintext?

Explanation

XOR — the only one of the four operations that undoes itself, so the same keystream both encrypts and decrypts.

A stream cipher combines each plaintext bit P with a keystream bit K: C = P ⊕ K. Applying the same keystream again gives C ⊕ K = P ⊕ K ⊕ K = P, because K ⊕ K = 0 and P ⊕ 0 = P.

Example: plaintext 1010 XOR keystream 0110 gives ciphertext 1100, and 1100 XOR 0110 gives 1010, the plaintext again.

Answer (d)

Why not others:

  • •(a) AND — wherever the key bit is 0 the output is 0 whatever the plaintext bit was, so that bit cannot be recovered
  • •(b) NAND — wherever the key bit is 0 the output is always 1, so again the plaintext bit is lost (it only inverts the bits where the key is 1)
  • •(c) OR — wherever the key bit is 1 the output is 1 whatever the plaintext bit was, so that bit is lost

Key rule: A combining operation works as a cipher only if it is reversible for every key bit; XOR flips a bit where the key is 1 and keeps it where the key is 0, so applying it twice restores the original.

Security · AI-written, may contain errors

This question comes from an official ITPEC past paper. ITPEC Practice is an independent study tool and is not affiliated with ITPEC. See the official FE past-paper collection or Report an issue.