The Hill cipher is a polygraphic substitution cipher based on linear algebra, invented by Lester S. Hill in 1929. It operates on blocks of letters (typically 2 or 3 at a time) and uses matrix multiplication for encryption and matrix inversion for decryption.
For encryption with a 2×2 matrix:
For decryption:
Where:
For the key matrix to be usable for decryption, it must be invertible in modulo 26 arithmetic. This means its determinant must not be zero and must be coprime with 26.
Encrypt and decrypt text using the Hill cipher
Determinant: 5
Invertible: Yes
The Hill cipher was a significant advancement in cryptography when it was introduced, but it has several security considerations:
Despite these limitations, the Hill cipher was historically important as one of the first practical polygraphic ciphers and for introducing mathematical concepts to cryptography. Modern cryptographic systems have built upon these foundations to create more secure encryption methods.