Skip to content
All tools
Classical cryptoRuns locallyNo account

Hill cipher solver

Encrypt and decrypt with matrix keys over mod 26, including matrix inversion and known-plaintext key recovery.

Open in ctfpal

The Hill cipher multiplies blocks of letters by a key matrix modulo 26. It was the first cipher to operate on more than three symbols at once, and it is linear - which makes it strong against frequency analysis and completely defenceless against known plaintext.

Known plaintext breaks it outright

With n blocks of known plaintext for an n x n key, you have a matrix equation C = K * P mod 26. Invert P and the key is K = C * P^-1. A 2x2 Hill cipher needs four known letters. Since flags are predictable text, this is nearly always available.

Related tools