Challenges
Affine cipher — finding the key
Cryptography
Medium
Affine cipher
Solves: 7
Affine cipher — finding the key
Author: CyberSamSU
Points
45
Now the key is not given. The message is encrypted with the Affine cipher: C = (a * P + b) mod 26.
The key space is very small: 12 variants for a (numbers coprime with 26), 26 for b — a total of 312 pairs. Try all of them and select the variant where the result is a readable Uzbek text.
Decryption formula: P = a⁻¹ * (C - b) mod 26, where a⁻¹ is the modular inverse of a modulo 26 (Python: pow(a, -1, 26)).
Ciphertext:
Uyhtu bitin illsv yhslns tsziv mgrszwiv. Oizsj vgkizuk, ikkg kukos
v tgzwiv duljzsozin ygvs ijsws ueh mux gv soosji. Kuygtici timngws
: TIMNGC{OZ4YY1O_4LL1V_O4Z1J_J0R1ZP1}
A simple method for automatic selection: check if there is a word like BAYROQ{ or xabar in the result.
To submit a flag, log in.