Applied Cryptography

In CTR mode, two messages were mistakenly encrypted with the same key and the same nonce. For the byte at one position, the first plaintext P₁ is 01001000 (ASCII "H"), its ciphertext C₁ is 01110100 and the second ciphertext C₂ is 01010101. If the attacker knows P₁, which of the following is the second plaintext P₂ at the same position?

  1. A00100001
  2. B00111100
  3. C01101001
Show answer and explanation

Answer: C. 01101001

With the same key and nonce the keystream K is the same, so C₁ = P₁ ⊕ K and C₂ = P₂ ⊕ K. First K = P₁ ⊕ C₁ = 01001000 ⊕ 01110100 = 00111100 is found, and then P₂ = C₂ ⊕ K = 01010101 ⊕ 00111100 = 01101001 (ASCII "i"). Without knowing the key, knowing one plaintext directly gives the other. For this reason, never using the same nonce twice under the same key is an essential condition in CTR mode and GCM.

  • A. 00100001 is C₁ ⊕ C₂, which equals P₁ ⊕ P₂. XORing it further with P₁ gives P₂.
  • B. 00111100 is the keystream obtained from P₁ ⊕ C₁. XORing it with C₂ gives P₂.
  • C. Correct. C₂ ⊕ (P₁ ⊕ C₁) = 01101001.
Practice this topic Back to topic

Books on Applied Cryptography Ad

As an Amazon Associate I earn from qualifying purchases.

More Applied Cryptography questions

  1. Which of the following does authenticated encryption (AEAD) such as AES-GCM provide in a single operation?
  2. Which of the following correctly describes the 96-bit nonce (IV) used in AES-GCM?
  3. On a certain machine, a brute-force search trying every 56-bit key takes about 20 hours. Which of the following is closest to the time the same machine needs to try every 64-bit key?
  4. Which of the following correctly describes the hash functions SHA-2 and SHA-3?
  5. Using the hash SHA-256(K ‖ m) of a secret key K concatenated with a message m as a tag for detecting tampering is considered dangerous. Which of the following is the reason?

Comparisons in this topic