Skip to main content
Challenges CTR: nonce reuse
Cryptography Medium Mode errors Solves: 8

CTR: nonce reuse

Author: CyberSamSU
Points
45

In CTR mode, the keystream depends only on the key and the nonce. If two messages are encrypted with the same key and the same nonce, both are XORed with exactly the same keystream. This causes the "two-time pad" problem.

The mathematics is very simple:

C1 = P1 XOR KS
C2 = P2 XOR KS
C1 XOR C2 = P1 XOR P2      <-- kalit butunlay yo'qoldi!

Therefore, if the text of one message is known to us, we can read the second one without any key.

First message (known, UTF-8):

Assalomu alaykum! Bu birinchi xabar, uning matni hammaga ma'lum. Ikkinchi xabar esa sir saqlanmoqda.

Its ciphertext (hex):

647ba37e813441fdc6a128cd7a46fbf489d738240557688eb6a043bd35fde081
4c76a427614e42baf1feb04694a1d2f07232044d9837ff5227ca3adcce0b0358
677585352aeca4a38bdac797fcfd707e6be48926e6809b7c451c8ab8eb7be64d
bc02ef63

The second message's ciphertext (hex) — with the exact same key and nonce:

6749894da20a57c9d5931bc23343edfcf7c6113a146a6cc8adba148a6daef08c
1a63e7672c0f5fe2f1e4

The message lengths are different — perform the XOR up to the length of the shorter one (zip() does this itself).

Hints 2
Opening a hint reduces the points you get for solving this challenge.
Hint 1 −4 pts Log in
Hint 2 −9 pts Log in
To submit a flag, log in.

First solvers

1. W.o.X 17.09.2026
2. Лазиз 04.10.2026
3. testrejim 09.10.2026
4. Mirjaxon Qaxxarov 27.10.2026
5. Odam 05.11.2026
6. arcanum 11.11.2026
7. Jasmin Xuseinova 15.11.2026
8. Doston Allayarov 28.11.2026