Frequency analysis — substitution cipher
In a simple substitution (monoalphabetic substitution) cipher, each letter of the alphabet is replaced by another single letter. The key is the scrambled alphabet itself, which means 26! ≈ 4·10²⁶ variations. Brute-force is completely impossible.
Nevertheless, this cipher is vulnerable to frequency analysis. Al-Kindi documented this method in the IX century: in natural language, letters are distributed unevenly, and this unevenness is preserved even after encryption.
Procedure:
- Count the letter frequency in the ciphertext. The most frequent letters in the Uzbek language are:
A,I,L,R,N,O,T,S,M,K. - Look at one-letter and two-letter words: words such as
VA,BU,HAR,ENG,UCHUN,BILANare found quickly. - Use repeating patterns: the text is about cybersecurity, therefore the words
PAROL,TARMOQ,XAVFSIZLIK,HUJUMappear. - Make guesses, partially reveal the text, and change your guess where it does not fit.
Important hint: numbers, punctuation marks, underscores and brackets are not encrypted — they remain in their places. Because of this, the flag format — ??????{??4??1?_...} — is clearly visible at the end of the text. The 6 letters before the flag correspond to the word BAYROQ; this gives you 6 letters right away.
The ciphertext is in the attached file: shifrlangan_maqola.txt (more than 1100 characters).
Solving by hand is also possible, but a faster way is to write a small program to test letter substitutions interactively.