Skip to main content
Challenges Unknown key length
Cryptography Hard Hamming distance and Kasiski Solves: 9

Unknown key length

Author: CyberSamSU
Points
85

Now there is no help at all: both the key and its length are unknown. This is the complete classic challenge of breaking a repeating-key XOR cipher (the famous "Break repeating-key XOR" from the Cryptopals set).

The solution consists of two steps:

  1. Finding the key length. For each L = 2..40, calculate the Hamming distance (the number of differing bits) between consecutive L-byte blocks of the ciphertext and divide it by L. The L that gives the smallest result is highly likely to be the key length.
  2. Recovering the key. Divide the ciphertext into L columns and solve each column as a separate single-byte XOR — try 256 keys and score the result (plus for spaces and lowercase letters, large minus for non-printable bytes).

The ciphertext is in the attached file, in base64 format: shifr.b64. The text is in Uzbek, with many spaces.

Hamming distance: bin(a ^ b).count('1') — gives how many bits differ in two bytes. For accuracy, do not take just one, but take at least 4 pairs of blocks and calculate the average.

Attached files
shifr.b64 Log in to download
SHA-256 checksums
shifr.b64: 17a3c752db8d75e179d0605814a6764fcbaff4645bfab034c15b9f2b6bf8d6c9
Hints 3
Opening a hint reduces the points you get for solving this challenge.
Hint 1 −8 pts Log in
Hint 2 −17 pts Log in
Hint 3 −25 pts Log in
To submit a flag, log in.

First solvers

1. Stiv_084100 11.09.2026
2. W.o.X 17.09.2026
3. Лазиз 04.10.2026
4. testrejim 09.10.2026
5. Mirjaxon Qaxxarov 26.10.2026
6. Odam 04.11.2026
7. arcanum 11.11.2026
8. pentester_uz 12.11.2026
9. AGENT X 25.11.2026