Monday, October 11, 2021

Hill Cipher | Example of Hill Cipher | Encryption and Decryption of Hill Cipher

     Introduction

There are basically two types of symmetric cipher: Substitution Cipher, Transposition Cipher.

Substitution Cipher: A substitution is a technique in which each letter or bit of the plaintext is substituted or replaced by some other letter, number or symbol to produce cipher text. For Example, ABC  XYZ.

Types of Substitution Cipher: Caesar Cipher, Monoalphabetic Cipher, Vigenère Cipher, Playfair Cipher, One time pad cipher (Vernam cipher), Hill Cipher.

Transposition Cipher: In transposition technique, there is no replacement of alphabets or numbers occurs instead their positions are changed or reordering of position of plain text is done to produce cipher text. For Example, ABCDE    BADEC.

 Types of Transposition Cipher: Rail Fence Cipher, Columnar Transposition Cipher.

 

Hill Cipher

Hill Cipher is polyalphabetic substitution cipher. This technique was developed by mathematician Laster Hill. Hill cipher based on linear algebra. Input of this technique are keyword and plain text. Keyword is given in matrix form.

 

Rules of encryption is as follows:

Step-1: Assign a number to each character of the Plain-Text, like (a = 0, b = 1, c = 2, … z = 25). As per given table.

For Example, Plain Text = SUNDAY S = 18, U = 20, N = 13, D = 3, A = 0, Y = 24

Step-2: 2x2 or 3x3 key matrix is given,

Step-3: Make a group of plain text as per given key matrix size. Each pair of plain text multiply with key matrix.

For Example, Plain Text = SUNDAY

If key matrix is 2 x 2, Plain text divided in into group of 2 alphabets: SU ND AY

If key matrix is 3 x 3, Plain text divided in into group of 3 alphabets: SUN DAY

Step-4: Multiplication of plain text matrix and key word matrix generate new matrix.

Step-5: Newly generated matrix values modules with 26.

Step-6: After modules 26, matrix values assign characters using rule no 1 table. It generates final cipher text.

 

Rules of decryption is as follows:

Step-1: Assign a number to each character of the cipher text, like (a = 0, b = 1, c = 2, … z = 25). As per given table.

For Example, Cipher Text = SUNDAY S = 18, U = 20, N = 13, D = 3, A = 0, Y = 24

Step-2: Find the inverse of given key matrix (2x2 or 3x3),

Step-3: Make a group of Cipher text as per given key matrix size. Each pair of Cipher text multiply with inverse key matrix.

For Example, Plain Text = SUNDAY

If key matrix is 2 x 2, Plain text divided in into group of 2 alphabets: SU ND AY

If key matrix is 3 x 3, Plain text divided in into group of 3 alphabets: SUN DAY

Step-4: Multiplication of cipher text matrix and inverse key word matrix generate new matrix.

Step-5: Newly generated matrix values modules with 26.

Step-6: After modules 26, matrix values assign characters using rule no 1 table. It generates final plain text.

 

Example of Hill Cipher (Key Matrix 2x2)

Encryption Process



Decryption Process



Example of Hill Cipher (Key Matrix 3x3)


To learn more about Hill Cipher, Click here


    Watch more videos click here.

No comments:

Post a Comment