Skip to main content
Challenges Hill cipher (2x2 matrix)
Cryptography Hard Hill cipher Solves: 13

Hill cipher (2x2 matrix)

Author: CyberSamSU
Points
95

The Hill cipher (Lester Hill, 1929) is the first cipher that brought linear algebra into cryptography. Plaintext letters are converted into numbers (A = 0 ... Z = 25), grouped by twos and multiplied by a square matrix:

| c1 |   | 3  3 |   | p1 |
|    | = |      | * |    |  (mod 26)
| c2 |   | 2  5 |   | p2 |

That is, c1 = (3*p1 + 3*p2) mod 26 and c2 = (2*p1 + 5*p2) mod 26.

For decryption, the inverse of the matrix modulo 26 is needed. To do this, first the determinant is calculated (det = 3*5 - 3*2 = 9), then its modular inverse is found (pow(9, -1, 26)), then it is multiplied by the adjugate matrix:

K⁻¹ = det⁻¹ * |  5  -3 |   (mod 26)
              | -2   3 |

For the matrix to be invertible, it is required that EKUB(det, 26) = 1; we have det = 9, the condition is met.

Ciphertext (divided into pairs):

KY ET DH CK EU FK DA

The plaintext is of even length, no padding character has been added. Flag: BAYROQ{KL4SS1K_<ochiq_matn>}

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

First solvers

1. W.o.X 11.09.2026
2. Лазиз 04.10.2026
3. BlackCipher 07.10.2026
4. testrejim 09.10.2026
5. 11111tttt 09.10.2026
6. Mirjaxon Qaxxarov 26.10.2026
7. gulrabo_1003 04.11.2026
8. Odam 04.11.2026
9. arcanum 11.11.2026
10. Furqat Turayev 11.11.2026