The Hill cipher is a polygraphic substitution cipher based on linear algebra. It was the first polygraphic cipher in which it was practical to operate on more than three symbols at once.

This article does not cover the algorithm behind the Hill cipher. We suggest going through the simple explanation given on Wikipedia for a detailed explanation on Encryption and Decryption.

 
Implementation:

Following is the implementation of the Hill cipher in C++:

Download  Run Code

Output:

The corresponding ciphertext is POHDXHCAFOZABNU
Inverse of a key
 
  8  5 10
 21  8 21
 21 12  8
 
The corresponding decrypted text is ACTBEFOREDAWNZZ

That’s all about Hill Cipher Implementation.