WOLFRAM|DEMONSTRATIONS PROJECT

Hill Cipher Encryption and Decryption

​
Select a message:
old age is not to blame for
Select a 2×2 matrix to encrypt your message:
a
3
b
0
c
0
d
7
QZJASCYWNUFDQHHAKCPUZF
oldageisnottoblameforx
encryption matrix:
3
0
0
7

decryption matrix:
9
0
0
15

In a Hill cipher encryption, the plaintext message is broken up into blocks of length
n
according to the
m×n
matrix chosen. Each block of plaintext letters is then converted into a vector of numbers and is dotted with the matrix. The results are then converted back to letters and the ciphertext message is produced. For decryption of the ciphertext message, the inverse of the encryption matrix must be found. Once found, the decryption matrix is then dotted with each
n
-block of ciphertext, producing the plaintext message.
​