Introduction

Cipher is referred to as a technique of writing some information in the form of a secret code. At present, the Ciphers operate on the sequence of binary bits, but traditionally Ciphers used numbers, letters, or symbols. One of those usually made ciphers is the Hill Cipher. A Hill Cipher is the application of linear algebra applied to cryptography. Cryptography is the technique to store and transmit data in a form so that only the viewers who can access it can read and process it.

In cryptography, the Hill Cipher is the polygraphic substitution cipher because it can work on digraphs and trigraphs, or theoretically, it can perform tasks on any sized block, given the condition that the block must consist of two letters at least. Hill Cipher was the first Cipher invented by Lester S. Hill in 1929 in which it was practical to operate on more than three symbols at a single time.

When information is sent using Cipher, and the receiver receives the encrypted code, the receiver has to guess which Cipher was used to encrypt the code, and then only it can be decrypted. In this system, each plaintext letter is represented by a number modulo 26. Often, each alphabet is assigned with the number it follows in the queue starting from A such that A=0, B=1, C=2 … Z=25, but this is not an important feature of a Hill Cipher. A Hill Cipher can perform tasks such as encryption of the plaintext message, Decryption of the same message. In this article, we will learn what is Hill Cipher? Then Hill Cipher Encryption, Hill Cipher Decryption, and Hill Cipher example to understand How to do a Hill Cipher?

  1. What is Hill Cipher?
  2. Hill Cipher Example
  3. How to do Hill Cipher

1. What is Hill Cipher?

In the easiest definition, Hill Cipher can be explained as a polygraphic substitution cipher that has its root in linear algebra. To understand the concepts of Hill Cipher, one is expected to have elementary knowledge about the matrices. The Hill Cipher was invented by an American mathematics educator named Lester S. Hill in the year 1929. The Hill Cipher uses concepts of modulo arithmetic, matrix multiplication, and matrix inverse. It can work on arbitrary sized blocks and so it is also a block cipher. One can encrypt the code using the Hill Cipher and then get it back decrypted. Instead of working with large numbers, the Hill Cipher works on groups of letters.

 In terms of security, the basic Hill Cipher is not so good, as anyone knowing linear algebra can easily decrypt the messages and read the information stored. Though the Key matrix must be known to decrypt the message.

2. Hill Cipher Example

Let A is equal to

, be the key and let us assume that plaintext message is HELP. 

This plaintext is represented by two pairs, as shown below:

Then it is computed,

And encryption is continued as follows:

The matrix K^-1 is invertible, hence there exists such that K^-1K=KK^-1=I2.

The inverse of K can be computed using the following formula:

If a modular multiplicative inverse is used to compute, this formula still holds after a modular reduction.

We compute as, 

Therefore, 

A) Encryption

Encryption is a technique that helps in converting a piece of information into some code or secret code. It hides the information’s true meaning or language and converts it into other letters, numbers, or symbols. A Hill Cipher encrypts the word into a number code. It uses concepts of linear algebra and the help of matrices to encrypt a word into number code. Cipher Key plays an important role in encrypting the decoded message. It is randomly chosen from the [n*n] matrix that must be an invertible matrix (modulo 26).

As told earlier, every letter of the alphabet is assigned with a digit. The first letter of the alphabet is assigned the value 0, and it continues in a queue till Z and therefore, the value of Z is 25.To encrypt a given message using the Hill Cipher, each letter of the block is considered a component of a vector. Each component is then multiplied by an invertible matrix against modulo 26. The invertible matrix that was used for Hill Cipher encryption is referred to as a key. 

 B) Decryption

Decryption is a technique that is required to decode the message that was encoded by the method of encryption. It is used to convert an encrypted message into the original form of the original information. A Hill Cipher decryption is done by multiplying each block’s component by the inverse of the Key matrix. To encrypt an encrypted word, Ciphertext is needed to convert into the vector form.   

3. How to do Hill Cipher

To operate Hill Cipher to perform Encryption and Decryption of a message, one should be aware of the mathematical concepts of linear algebra and Matrices. Hill Cipher can easily work on two or more than two blocks. Hill Cipher algorithms to perform encryption and decryption are easy to learn. All you need is the focus and good command over linear algebra and matrices. 

It must be noted that to encrypt and to decrypt a message, an invertible matrix is required. Only an invertible matrix can be used to operate using the Hill Cipher. The invertible matrix has a determination of value 0. Let us look at encryption and decryption of the message using Hill Cipher.

A) Hill Cipher Encryption

  • The first and the foremost step to encrypt a message, one must select a message that is to be encrypted. 
  • After that, convert the message into the matrix using the matrix substitution method. 
  • Convert the plaintext message into the vector form that is to be multiplied with the matrix.
  • Finally, multiply the key matrix with the vector using the property of the matrix and then take modulo of the resulting vector-matrix by 26.

B) Hill Cipher Decryption

  • To perform decryption of a Hill Cipher message, we have to calculate the inverse of the key matrix. It must be kept in mind that the result must lie between 0 to 25.
  • Next, you will need to multiply the blocks of Ciphertext with the inverse of the key matrix. 
  • Following all these steps will get us our resultant code that can be translated to the original message.

Conclusion

So, have you made up your mind to make a career in Cyber Security? Visit our Master Certificate in Cyber Security (Red Team) for further help. It is the first program in offensive technologies in India and allows learners to practice in a real-time simulated ecosystem, that will give them an edge in this competitive world.

Also Read

SHARE
share

Are you ready to build your own career?