Skip to main content
Challenges Self-keyed flag
Cryptography Expert Crib dragging Solves: 12

Self-keyed flag

Author: CyberSamSU
Points
140

A lazy programmer, too lazy to come up with a key, took the beginning of the flag itself as the key and performed a repeating XOR on the flag with this key: ct[i] = flag[i] ^ flag[i % L], where L is the key length, i.e. the number of bytes taken from the beginning of the flag. The value of L is not told to you.

Both the plaintext and the key are the one and same secret string. Statistics will not help here — the text is too short. The only anchor point: we know the flag format, it starts with BAYROQ{ and ends with }, and inside there will only be A-Z a-z 0-9 _ characters.

This is the crib dragging technique: placing a known part (crib) over the ciphertext to extract information about the key from it, and then brute-forcing the remaining unknown bytes within a narrow set.

Ciphertext (hex):

000000000000000000101e6928106101695e731e326623600f0741732d3e6621
0e196c493071282f

There will be many candidates, so we provide an exact check — the SHA-256 value of the correct flag:

5719819430556a72988a16c10c185a41ddc5da86ef608cbfd8d259edcbfe1fd8

Look very carefully at the beginning of the ciphertext. There is a ready answer to the question about the key length there — think about why this has happened.

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

First solvers

1. W.o.X 09.09.2026
2. Stiv_084100 11.09.2026
3. Абдул 15.09.2026
4. Лазиз 01.10.2026
5. Faxriddin Oripov 02.10.2026
6. testrejim 09.10.2026
7. 11111tttt 09.10.2026
8. Mirjaxon Qaxxarov 26.10.2026
9. anonym 29.10.2026
10. Odam 04.11.2026