Professional Documents
Culture Documents
Maths Project
Maths Project
ENCODING message:
key× message in matrix form
= [ 31 52] [ 195 12 0 15
12 14 23 ]
DECODING message:
Inverse of key = [−12 −53 ]
It's worth noting that while the Hill cipher and matrix-based
cryptography have their merits, they are not widely used in
modern cryptographic systems. More advanced algorithms,
such as the Advanced Encryption Standard (AES), have replaced
them due to their higher security and efficiency.
HILL CIPHER:
1.ENCRYPTION:
( ) mod 26
K 11 K 12 K 13
(c1 c2 c3) = (p1 p2 p3) K 21 K 22 K 23
K 31 K 32 K 33
C1=(P1K11+P2K21+P3K31) mod 26
C2=(P1K12+P2K22+P3K32) mod 26
C3=(P1K13+P2K23+P3K33) mod 26
( )
17 17 5
21 18 21
2 2 19
Ans.
p a y m o r e m o n e y
15 0 24 12 14 17 4 12 14 13 4 24
( ) mod 26
K 11 K 12 K 13
(c1 c2 c3) = (p1 p2 p3) K 21 K 22 K 23
K 31 K 32 K 33
( ) mod 26
17 17 5
(c1 c2 c3) = (15 0 4) 21 18 21
2 2 19
= (15*17+0*21+24*2 15*17+0*18+24*2
15*5+0*21+24*19) mod 26
= (303 303 531) mod 26
= (17 17 11)
= (R R L)
Encrypting mor
( ) mod 26
K 11 K 12 K 13
(c1 c2 c3) = (p1 p2 p3) K 21 K 22 K 23
K 31 K 32 K 33
( ) mod 26
17 17 5
(c1 c2 c3) = (12 14 17) 21 18 21
2 2 19
= (12*17+14*21+17*2 12*17+14*18+17*2
12*5+14*21+17*19) mod 26
= (532 490 677) mod 26
= (12 22 1)
= (M W B)
Encrypting emo
( ) mod 26
K 11 K 12 K 13
(c1 c2 c3) = (p1 p2 p3) K 21 K 22 K 23
K 31 K 32 K 33
( ) mod 26
17 17 5
(c1 c2 c3) = (4 12 14) 21 18 21
2 2 19
= (4*17+12*21+14*2 4*17+12*18+14*2
4*5+12*21+14*19) mod 26
= (348 312 538) mod 26
= (10 0 18)
= (K A S)
Encrypting ney
( ) mod 26
K 11 K 12 K 13
(c1 c2 c3) = (p1 p2 p3) K 21 K 22 K 23
K 31 K 32 K 33
( ) mod 26
17 17 5
(c1 c2 c3) = (13 4 24) 21 18 21
2 2 19
= (13*17+4*21+24*2 13*17+4*18+24*2
13*5+4*21+24*19) mod 26
= (348 312 538) mod 26
= (15 3 7)
= (P D H)
Plaintext: pay more money
Ciphertext: RRLMWBKASPDH
HILL CIPHER:
2.DECRYPTION:
The Hill Algorithm for decryption:
This can be expressed as,
P= D (K, C)= C× K mod 26(K=key, C=ciphertext, P=plaintext)
−1
1
−1
k =
DET K
×ADJ K
( ) mod 26
14 25 7
1
K
−1
= 23
7 1 8
6 0 1
( ) mod 26
14 25 7
K
−1
= 17 7 1 8
6 0 1
( ) mod 26
238 425 119
K
−1
= 119 17 136
102 0 17
( )
4 9 15
K
−1
= 15 17 6
24 0 17
P = C× K
−1
mod 26
R R L M W B K A S P D H
17 17 11 12 22 1 10 0 18 15 3 7
Decrypting:
(
) mod 26
4 9 15
(P1 P2 P3) = (R R L) 15 17 6
24 0 17
= (17*4+17*15+11*24 17*9+17*17+11*0
17*15+17*6+11*17) mod 26
= (587 442 544) mod 26
= (15 0 4)
= (p a y)
CT R R L M W B K A S P D H
PT p a y m o r e m o n e y