Hill cipher solver
Encrypt and decrypt with matrix keys over mod 26, including matrix inversion and known-plaintext key recovery.
Open in ctfpalThe 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
Playfair cipher decoder
Decrypt Playfair with a known keyword, using the 5x5 digraph square. Recognisable by its even length and total absence of doubled letters.
Affine cipher solver
Brute-force every valid affine key pair and rank the 312 candidate decryptions by English-likeness.
Modular arithmetic and number theory toolkit
Modular inverse, Chinese remainder theorem, Tonelli-Shanks square roots, Jacobi symbols, and integer nth roots - arbitrary precision, in the browser.
Caesar cipher decoder with automatic shift detection
Break a Caesar shift without guessing. ctfpal scores all 26 rotations by chi-squared letter frequency and puts the English one first.