0% found this document useful (0 votes)
68 views

Name: Maria Nazir Class: Bsit Semester: 7 Roll No: 18 Subject: (NS) Submitted To: Ma'am Tanzeela

Maria Nazir is a 7th semester BSIT student. She was asked to encrypt and decrypt the message "Meet me on Wednesday" using the Hill cipher with a given key matrix. [She provides details on how the Hill cipher works including setting up the key matrix, encrypting by multiplying it with the plaintext converted to numerical values, and decrypting by finding the inverse key matrix and decrypting in a similar manner.] Maria is able to successfully encrypt the plaintext to "UKQX UK OF EIDCDPWJ" and decrypt it back to the original message.

Uploaded by

M. Malik
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
68 views

Name: Maria Nazir Class: Bsit Semester: 7 Roll No: 18 Subject: (NS) Submitted To: Ma'am Tanzeela

Maria Nazir is a 7th semester BSIT student. She was asked to encrypt and decrypt the message "Meet me on Wednesday" using the Hill cipher with a given key matrix. [She provides details on how the Hill cipher works including setting up the key matrix, encrypting by multiplying it with the plaintext converted to numerical values, and decrypting by finding the inverse key matrix and decrypting in a similar manner.] Maria is able to successfully encrypt the plaintext to "UKQX UK OF EIDCDPWJ" and decrypt it back to the original message.

Uploaded by

M. Malik
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 6

Name: Maria Nazir

Class: BSIT
Semester: 7th
Roll no : 18
Subject : (NS)
Submitted to: Ma’am Tanzeela

QNO:1

Encrypt and decrypt message “Meet me on Wednesday” by using hill cipher


with key matrix value ?

Ans:
Hill cipher:
 The Hill Cipher was invented by Lester S.

 Hill in 1929, and like the other Digraphic Ciphers it acts on groups of letters.

 Unlike the others though it is extendable to work on different sized blocks of letters. So,
technically it is a polygraphic substitution cipher, as it can work on digraphs, trigraphs (3
letter blocks) or theoretically any sized blocks.

Area for hill cipher:


The Hill Cipher uses an area of mathematics called Linear Algebra, and in particular requires the
user to have an elementary understanding of matrices. It also make use of Modulo Arithmetic
(like the Affine Cipher). Because of this, the cipher has a significantly more mathematical nature
than some of the others. However, it is this nature that allows it to act (relatively) easily on
larger blocks of letters.

Encryption

Steps:
 To encrypt a message using the Hill Cipher we must first turn our keyword into a key matrix
(a 2 x 2 matrix for working with digraphs, a 3 x 3 matrix for working with trigraphs, etc).

 We also turn the plaintext into digraphs (or trigraphs) and each of these into a column
vector. We then perform matrix multiplication modulo the length of the alphabet (i.e. 26)
on each vector. These vectors are then converted back into letters to produce the
ciphertext

 We now split the plaintext into digraphs, and write these as column vectors. That is, in
the first column vector we write the first plaintext letter at the top, and the second letter at
the bottom. Then we move to the next column vector, where the third plaintext letter goes
at the top, and the fourth at the bottom. This continues for the whole plaintext.

 Each letter is replaced by its appropriate number.


 Now we must perform some matrix multiplication. We multiply the key matrix by each
column vector in turn. We shall go through the first of these in detail, then the rest shall be
presented in less detail. We write the key matrix first, followed by the column vector.

 we have to take each of these numbers, in our resultant column vector, modulo 26
(remember that means divide by 26 and take the remainder).

Plain text: Meet me on Wednesday

1 2
5 7 
Key matrix  

Table:
A B C D E F G H I J

0 1 2 3 4 5 6 7 8 9

K L M N O P Q R S T

10 11 12 13 14 15 16 17 18 19

U V W X Y Z

20 21 22 23 24 25

Now I am goimg to mke pairs of my plain text such as:

ME , ET, ME, ON, WE, DN, ES, DA, YZ

Now I am going to replace each letter by the number corresponding to its position such as
A=0,B=1…..Z=25.

Formula:

C= kpmod(26)
Now we must perform some matrix multiplication. We multiply the key matrix by each column
vector in turn. We shall go through the first of these in detail, then the rest shall be presented
in less detail. We write the key matrix first, followed by the column vector.

Such as:

C= mod26which will be equal to

Similarly we will multiply our key matrix with all the other pairs of plain text then the result will
be as follows:

since this equal to

Similarliy for others:

mod26which will be equal to

Since our result will be:

Plain text: Meet me on Wednesday


Cipher text: UKQX UK OF EIDCDPWJ

Deincryption:
 To decrypt a ciphertext encoded using the Hill Cipher, we must find the inverse matrix.

 Once we have the inverse matrix, the process is the same as encrypting. That is we
multiply the inverse key matrix by the column vectors that the ciphertext is split into, take
the results modulo the length of the alphabet, and finally convert the numbers back to
letters.

Step 1 - Find the Multiplicative Inverse of the Determinant

Step 2 - Find the Adjugate Matrix

Step 3 - Multiply the Multiplicative Inverse of the Determinant by the Adjugate Matrix

Solution:
We will convert our cipher text into plain text

We will devide our cipher text into pairs as follows:

First we have to take a determinent of key matrix

Now we will find the multiplicative inverse of the determinent

d dinverse= 1mod26

(-3*-9)mod26=1

27mod26=1

1=1

Now we will find adjient of key


Adj(K)=Adj

We will remove the negitive value before we deincrypt by adding the value 26

Adj(k)=

Since kinverse will be

Now we will take module of this inverse by 26

K(inverse)=

Formula for deincryption:

P= k(inverse)Cmod26

P=

Similarliy for others :

For c=

Plain text will be P=

This process wil go till end and hence we will receive our result as follows:

Ciphere text: UKQXUKOFEIDCOQDPWJ

Plain text: Meet me on wednesday

< THE end>

You might also like