CNS Assignment

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 8

121910310030

Cryptography And Network Security


19ECS305

NAME : M.L.SANDEEP
REGD.NO. : 121910310030
ASSIGNMENT : 01
SECTION : B10

1|Page
121910310030

Hill Cipher

Plain Text = 121910310030


Key = hill

Now, Convert the “Hill” into a Matrix format using the given table.

a b c d e f g h i j k l m
0 1 2 3 4 5 6 7 8 9 10 11 12
n o p q r s t u v w x y z
13 14 15 16 17 18 19 20 21 22 23 24 25

ℎ 𝑖 7 8
key (k) = [ ]=[ ]
𝑙 𝑙 11 11
Encryption :
Formula : Cipher Text = PK mod 26
Now, Take The Two Numerals From The Plain Text.

STEP-1:
P = (1 2)
7 8
K=[ ]
11 11
7 8
C = (1 2) * K=[ ] mod 26
11 11
C = (29 30) mod 26 = (3 4)
Therefore, Cipher Text Of (1 2) is (3 4)

2|Page
121910310030

STEP-2 :
P = (1 9)
7 8
K=[ ]
11 11
7 8
C = (1 9) * K=[ ] mod 26
11 11
C = (106 107) mod 26 = (2 3)
Therefore, Cipher Text Of (1 9) is (2 3)

STEP-3 :
P = (1 0)
7 8
K=[ ]
11 11
7 8
C = (1 0) * K=[ ] mod 26
11 11
C = (7 8) mod 26 = (7 8)
Therefore, Cipher Text Of (1 0) is (7 8)

STEP-4 :
P = (3 1)
7 8
K=[ ]
11 11
7 8
C = (3 1) * K=[ ] mod 26
11 11
C = (32 35) mod 26 = (6 9)
Therefore, Cipher Text Of (3 1) is (6 9)

3|Page
121910310030

STEP-5 :
P = ( 0 0)
7 8
K=[ ]
11 11
7 8
C = (0 0) * K=[ ] mod 26
11 11
C = (0 0) mod 26 = (0 0)
Therefore, Cipher Text Of (0 0) is (0 0)

STEP-6 :
P = (3 0)
7 8
K=[ ]
11 11
7 8
C = (3 0) * K=[ ] mod 26
11 11
C = (21 24) mod 26 = ()
Therefore, Cipher Text Of (3 0) is (21 24)

The Encrypted Text i.e. Cipher Text is 34237869002124

4|Page
121910310030

Decryption :

Formula : Plain Text = CK-1 mod 26


K = adj(k) / |K|
11 −8 + 26 11 18
adj(k) = [ ]=[ ]
−11 + 26 7 15 7
|K| = |(a*d)-(b*c)| = |77-88| = |-11+26| = 15
K-1 = adj(K)/ |K|
1/|K|→(15*d-1 ) mod 26 = 1
Using Trail and Error Method, d-1 = 7
Therefore, 1/|K| = 7
11 18 77 126
K-1 = 7*[ ]=[ ]
15 7 105 49

STEP-1 :
C.T = (3 4)
77 126
K-1 = [ ]
105 49
Plain Text = CK-1 mod 26
77 126
P.T. = (3 4)*[ ] mod 26
105 49
P.T. = (651 574) mod 26 = (1 2)
Therefore, Plain Text of (3 4) is (1 2)

5|Page
121910310030

STEP-2 :
C.T = (2 3)
77 126
K-1 = [ ]
105 49
Plain Text = CK-1 mod 26
77 126
P.T. = (2 3)*[ ] mod 26
105 49
P.T. = (469 399) mod 26 = (1 9)
Therefore, Plain Text of (2 3) is (1 9)

STEP-3 :
C.T = (7 8)
77 126
K-1 = [ ]
105 49
Plain Text = CK-1 mod 26
77 126
P.T. = (7 8)*[ ] mod 26
105 49
P.T. = (1379 1274) mod 26 = (1 0)
Therefore, Plain Text of (7 8) is (1 0)

6|Page
121910310030

STEP-4 :
C.T = (6 9)
77 126
K-1 = [ ]
105 49
Plain Text = CK-1 mod 26
77 126
P.T. = (6 9)*[ ] mod 26
105 49
P.T. = (1407 1197) mod 26 = (3 1)
Therefore, Plain Text of (6 9) is (3 1)

STEP-5 :
C.T = (0 0)
77 126
K-1 = [ ]
105 49
Plain Text = CK-1 mod 26
77 126
P.T. = (3 4)*[ ] mod 26
105 49
P.T. = (0 0) mod 26 = (0 0)
Therefore, Plain Text of (0 0) is (0 0)

7|Page
121910310030

STEP-6 :
C.T = (21 24)
77 126
K-1 = [ ]
105 49
Plain Text = CK-1 mod 26
77 126
P.T. = (21 24)*[ ] mod 26
105 49
P.T. = (4137 3822) mod 26 = (3 0)
Therefore, Plain Text of (21 24) is (3 0)

Hence, The Plain Text Of 34237869002124 is 121910310030

Hence Encryption And Decryption has been completed.

8|Page

You might also like