Hill Cipher

The Hill Cipher is a polygraphic substitution cipher that uses linear algebra to encrypt and decrypt messages. It operates on blocks of letters, instead of individual letters, and uses a matrix as the key for encryption. The matrix must be invertible, and its size determines the number of letters in each block. To encrypt a message, each block of letters is converted into a vector and multiplied by the key matrix. The resulting vector is then converted back into a block of letters. The Hill Cipher was invented by Lester Hill in 1929 and is more secure than simple substitution ciphers, but it is vulnerable to known-plaintext attacks and requires a large key space to be truly secure.

Try It!

Encrypted Text
Decrypted Text