0% found this document useful (0 votes)
159 views5 pages

Hill Cipher

Hill cipher is a polygraphic cipher that encrypts multiple letters as a group. It uses linear algebra where each letter is assigned a number and encryption is performed by multiplying the plaintext vector by the encryption key matrix. For example, the plaintext "paymoremoney" encrypted with the key matrix [[11,13,5],[15,17,6],[24,0,17]] results in the ciphertext "LNSHDLEWMTRW". Decryption requires multiplying the ciphertext vector by the inverse of the encryption key matrix. The document also provides an example of decrypting a ciphertext and finding the encryption key given a plaintext and ciphertext.

Uploaded by

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

Hill Cipher

Hill cipher is a polygraphic cipher that encrypts multiple letters as a group. It uses linear algebra where each letter is assigned a number and encryption is performed by multiplying the plaintext vector by the encryption key matrix. For example, the plaintext "paymoremoney" encrypted with the key matrix [[11,13,5],[15,17,6],[24,0,17]] results in the ciphertext "LNSHDLEWMTRW". Decryption requires multiplying the ciphertext vector by the inverse of the encryption key matrix. The document also provides an example of decrypting a ciphertext and finding the encryption key given a plaintext and ciphertext.

Uploaded by

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

Technical collage /Najaf Communication security

4- Hill cipher:

Hill cipher is a multiletter cipher . The encryption algorithm takes m


successive plaintext letters and substitutes for them m ciphertext letters.
The substitution is determined by m linear equations in which each
character is assigned a numerical value (a = 0, b = 1 ... z = 25). For m = 3,
the system can be described as follows:

This can be expressed in term of column vectors and matrices:

Or

C is cipher letter (3x1)


K is key (3x3).
P is plaintext letter (3x1).

In general terms, the Hill system can be expressed as follows:

By Marwa Al-Musawy
-18-
Technical collage /Najaf Communication security

Ex: plaintext = paymoremoney


and use the encryption key is

Find the ciphertext?


Sol:
pay mor emo ney
first three letters p=15 , a=0 , y=24
this can be represented in vector as :
15
P= 0
24
Then;

C=K P mod 26= mod26

11 = L , 13 = N , 18 = S

So , pay LNS .continuing in this fashion,

The ciphertext for the entire plaintext is LNSHDLEWMTRW.

Ex :

Decrypt the above ciphertext ?

Sol.

Decryption requires using the inverse of the matrix K. The inverse K

By Marwa Al-Musawy
-19-
Technical collage /Najaf Communication security

of a matrix K is defined by the equation KK = K K = I,

This is demonstrated as follows:

P= D(K,C)= K . C mod 26

P1 4 9 15 11 15 p
P2 = 15 17 6 13 mod26= 0 a
P3 24 0 17 5 24 y

H.W
The plaintext "friday" is encrypted using a 2 x 2 Hill cipher to yield the
ciphertext PQCFKU, find the encrypted key?

Note: to find additive inverse modulo n of an integer we use the table


below ,as example modulo 5

0 1 2 3 4
0 0 1 2 3 4
1 1 2 3 4 0
2 2 3 4 0 1
3 3 4 0 1 2
4 4 0 1 2 3

By Marwa Al-Musawy
-20-
Technical collage /Najaf Communication security

The negative of integer x is the integer y ,such that


( x+ y) mod n =0
(x+y) mod 5=0
If x=2 y=3 because (2+3)mod 5=0

If x=4 y=1 because (4+1) mod 5=0


While the multiplicative inverse of an integer x is y such that
(x* y) mod n=1
Example of modulo 5 multiplicative invers of an integer x is
0 1 2 3 4
0 0 0 0 0 0
1 0 1 2 3 4
2 0 2 4 1 3
3 0 3 1 4 2
4 0 4 3 2 1

(x*y) mod 5 =1

If x= 2 y=3 because (2*3) mode 5=1

If x= 4 y=4 because (4*4) mod 5=1

Example :

Find 5 8 for modulo 26 ?

17 3

solution :

By Marwa Al-Musawy
-21-
Technical collage /Najaf Communication security

By Marwa Al-Musawy
-22-

You might also like