The Hill cipher is a historic polygraphic substitution cipher invented by Lester S. Hill in 1929. It was the first substitution cipher to allow operations on groups of more than three plaintext characters at a time.
The Hill cipher is based on linear algebra, specifically matrix multiplication. It works by mapping the plaintext letters into numbers, dividing the resulting number sequence into blocks of n numbers, each of which is interpreted as an n element vector and multiplied with an invertible n × n key matrix (using modular arithmetic) to obtain the corresponding block of ciphertext. Decryption works the same way, except that the key matrix is replaced with its inverse.
On its own, the Hill cipher is insecure, being vulnerable to a simple known plaintext attack: an attacker who knows the plaintext corresponding to at least n blocks of ciphertext can solve a system of linear equations to (with high probability) recover the full key matrix. In U.S. patent 1,845,947, describing a mechanical implementation of the cipher for n = 6 (with a fixed key matrix), Hill recommended combining the cipher with a non-linear monographic substitution to thwart such attacks.