Enter a 4-letter (2×2) or 9-letter (3×3) key. No key? “Find the key” cracks 2×2.
Turn the letters into numbers, A=0 to Z=25, and take them in blocks: pairs for a 2×2 key, triples for a 3×3. Each block is a column of numbers, and the key is a square grid of numbers, the key matrix. Multiply the matrix by the column and take each result mod 26 to get the ciphertext block.
With the key GYBNQKURP (6 24 1 / 13 16 10 / 20 17 15) the block ACT (0, 2, 19) becomes:
POHso ACT encrypts to POH. Decryption multiplies by the inverse matrix instead. A key only works if that inverse exists mod 26, which means its determinant must be odd and not divisible by 13. The tool checks this for you.
Lester S. Hill published it in 1929. It was the first cipher built on algebra rather than tables, and the first practical one to encrypt blocks of more than three letters at once (Playfair, from 1854, works on pairs). Because every letter in a block affects every other, a single letter's frequency gives almost nothing away.
The Hill cipher falls quickly to a known stretch of plaintext, because the equations can simply be solved. Without one, a 2×2 key is still weak. Each row of the decryption matrix produces every other plaintext letter on its own, so each row's 676 possibilities can be scored separately against English letter frequencies, then the best rows combined. “Find the key” does exactly that. A 3×3 key has too many possibilities for that trick to work in a browser.
Letters become numbers (A=0 to Z=25) and are taken in blocks of two or three. Each block is multiplied by the key matrix, mod 26. Lester Hill published it in 1929, and it was the first cipher built on linear algebra.
Decryption needs the key matrix's inverse mod 26, which only exists when the determinant is odd and not a multiple of 13. Change one letter of the key and try again.
Each row of the decryption matrix produces every other plaintext letter on its own, so each row's 676 possibilities can be scored separately against English letter frequencies. The best rows are then paired up and the full decryptions ranked.