Assignment Hill Cipher (1)
Assignment Hill Cipher (1)
Dept. of
Computer Science and Engineering
Assignment on
Encryption and Decryption using Hill Cipher method
Submitted to Submitted by
Md. Mohibullah Chayti Saha
Lecturer, ID: 11608031
Dept. of CSE Session: 2015-16
Comilla University Comilla University
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.
[ ]
6 24 1
Key: 13 16 10
2 0 17 15
Encryption:
Step - 1:
Converting the plain text into column vector: We split the plaintext into trigraphs
because the given key matrix is a 3*3 matrix and write these as column vectors.
[]
A
C
T
Plain text into numeric column vector(trigraph): We must convert the plaintext
column vectors in the same way that we converted the keyword into the key matrix. Each letter is
replaced by its appropriate number.
[]
0
2
19
Step – 2: Now we must perform some matrix multiplication. We multiply the key matrix by
each column vector in turn. We write the key matrix first, followed by the column vector. Next,
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). Finally, we have to convert these numbers back
to letters to get cipher text.
[ ][ ] [ ][ ]
6 24 1 A 6 24 1 0
13 16 10 C = 13 16 10 2
20 17 15 T 20 17 15 19
[ ]
6∗0+24∗2+1∗19
= 13∗0+16∗2+10∗2
20∗0+17∗2+ 15∗19
[ ][] []
67 15 P
= 222 = 14 mod 26 = O
319 7 H
Decryption: To decrypt a cipher text 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 cipher text is split into, take the
results modulo the length of the alphabet, and finally convert the numbers back to letters.
In general, to find the inverse of the key matrix, we perform the calculation below, where K is
the key matrix, d is the determinant of the key matrix and adj(K) is the adjugate matrix of K.
\
Step – 1:
Determinant of key matrix:
| |
6 24 1
13 16 10 = 6*(16*15 – 17*10) – 24*(13*15 -20*10) + 1*(13*17 – 20*16)
2 0 17 15
= 441 = 25 mod 26
Multiplicative inverse of determinant:
d.d-1 = 1 mod 26
or, 23 x = 1 mod 26
25 x −1
So, 26
f(x)
x=1 0.92
x=2 1.88
x=3 2.84
x=4 3.80
x=5 4.76
x=6 5.73
x=7 6.69
x=8 7.65
x=9 8.61
x = 10 9.57
x = 11 10.53
x = 12 11.50
x = 13 12.46
x = 14 13.42
x = 15 14.38
x = 16 15.34
x = 17 16.30
x = 18 17.26
x = 19 18.23
x = 20 19.19
x = 21 20.15
x = 22 21.11
x = 23 22.07
x = 24 23.03
x = 25 24
[ ]
|16 10
17 15|+ −|
13 10
2 0 15 | +|
20 17|
13 16
[ 15 ]
6 24 1
10 = −| | +| | −|
20 17|
24 1 6 1 6 24
cofactor 13 16
17 15 2 0 15
2 0 17
+|24 1 | −| 6 1 | +| 6 24|
16 10 13 10 13 16
[ ]
|16 10
17 15|
+ −|
24 1
17 15 | +|
16 10|
24 1
[ 15 ]
6 24 1
10 = −| | +| | −|
13 10|
13 10 6 1 6 1
adj 13 16 20 15 20 15
20 17
+|13 16| −| 6 24| +| 6 24|
20 17 20 17 13 16
[ ]
70 −343 224
= 5 70 −47
−99 378 −216
[ ]
18 21 16
= 5 1 8 5 mod 26
5 14 18
Step – 3:
The inverse matrix is:
[ ][ ]
18 21 16 450 525 400
25 5 18 5 = 125 450 125
5 14 18 125 350 450
[ ]
8 5 10
= 21 8 21 mod 26
21 12 8
Step – 4:
Converting the cipher text into column vector:
[]
P
O
H
[]
15
14
7
Step – 5:
Decryption of the trigraph:
[ ][ ] [ ][ ]
8 5 10 P 8 5 10 15
21 8 21 O = 21 8 21 14
21 12 8 H 21 12 8 7
[ ]
8∗15+ 5∗14 +10∗7
= 21∗15+ 8∗14 +21∗7
21∗15+12∗14+ 8∗7
[ ][] []
260 0 A
= 574 = 2 mod 26 = C
539 19 T
Encryption:
Step - 1:
Converting the plain text into row wise matrix: We split the plaintext into 1*3 matrix
because the given key matrix is a 3*3 matrix and write these as column vectors.
[ A C T]
Plain text into numeric row wise matrix: We must convert the plaintext row wise
matrices in the same way that we converted the keyword into the key matrix. Each letter is
replaced by its appropriate number.
[ 0 2 19 ]
Step – 2: Now we must perform some matrix multiplication. We multiply each row wise
matrix by the key matrix in turn. We write row wise matrix first, followed by the key matrix.
Next, we have to take each of these numbers, in our resultant row wise matrix, modulo 26
(remember that means divide by 26 and take the remainder). Finally, we have to convert these
numbers back to letters to get cipher text.
[ ] [ ]
6 24 1 6 24 1
[A C T ] 13 16 10 = [ 0 2 19 ] 13 16 10
20 17 15 20 17 15
[ ][ ]
18 21 16 450 525 400
25 5 18 5 = 125 450 125
5 14 18 125 350 450
[ ]
8 5 10
= 21 8 21 mod 26
21 12 8
Step – 4:
Converting the cipher text into row wise matrix:
[Q R T ]
Step – 5:
Decryption of first row wise matrix:
[ ] [ ]
8 5 10 8 5 10
[ Q R T ] 21 8 21 = [ 16 17 19 ] 21 8 21
21 12 8 21 12 8
[ ]
6 24 1
Key: 13 16 10
2 0 17 15
Encryption:
Step - 1:
Converting the plain text into column vector: We split the plaintext into trigraphs
because the given key matrix is a 3*3 matrix and write these as column vectors.
[]
C
A
T
Plain text into numeric column vector(trigraph): We must convert the plaintext
column vectors in the same way that we converted the keyword into the key matrix. Each letter is
replaced by its appropriate number.
[]
2
0
19
Step – 2: Now we must perform some matrix multiplication. We multiply the key matrix by
each column vector in turn. We write the key matrix first, followed by the column vector. Next,
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). Finally, we have to convert these numbers back
to letters to get cipher text.
[ ][ ] [ ][ ]
6 24 1 C 6 24 1 2
13 16 10 A = 13 16 10 0
20 17 15 T 20 17 15 19
[ ]
6∗2+ 24∗0+1∗19
= 13∗2+16∗0+10∗2
20∗2+17∗0+ 15∗19
[ ][] []
31 5 F
= 216 = 8 mod 26 = I
325 13 N
Decryption: To decrypt a cipher text 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 cipher text is split into, take the
results modulo the length of the alphabet, and finally convert the numbers back to letters.
In general, to find the inverse of the key matrix, we perform the calculation below, where K is
the key matrix, d is the determinant of the key matrix and adj(K) is the adjugate matrix of K.
\
Step – 1:
Determinant of key matrix:
| |
6 24 1
13 16 10 = 6*(16*15 – 17*10) – 24*(13*15 -20*10) + 1*(13*17 – 20*16)
20 17 15
= 441 = 25 mod 26
Multiplicative inverse of determinant:
d.d-1 = 1 mod 26
or, 23 x = 1 mod 26
25 x −1
So, 26
f(x)
x=1 0.92
x=2 1.88
x=3 2.84
x=4 3.80
x=5 4.76
x=6 5.73
x=7 6.69
x=8 7.65
x=9 8.61
x = 10 9.57
x = 11 10.53
x = 12 11.50
x = 13 12.46
x = 14 13.42
x = 15 14.38
x = 16 15.34
x = 17 16.30
x = 18 17.26
x = 19 18.23
x = 20 19.19
x = 21 20.15
x = 22 21.11
x = 23 22.07
x = 24 23.03
x = 25 24
Step – 2:
Finding adjugate matrix:
[ ]
|17 15| |20 15| |20 17|
16 10
−+
13 10
+
13 16
[ 15 ]
6 24 1
10 = −| | +| | −|
20 17|
24 1 6 1 6 24
cofactor 13 16
17 15 20 15
20 17
+|24 1 | −| 6 1 | +| 6 24|
16 10 13 10 13 16
[ ]
|17 15| |17 15| |16 10|
16 10
+ −
24 1
+
24 1
[ 15 ]
6 24 1
10 = −| | +| | −|
13 10|
13 10 6 1 6 1
adj 13 16
20 15 20 15
20 17
+|13 16| −| 6 24| +| 6 24|
20 17 20 17 13 16
[ ]
70 −343 224
= 5 70 −47
−99 378 −216
[ ]
18 21 16
= 5 18 5 mod 26
5 14 18
Step – 3:
The inverse matrix is:
[ ][ ]
18 21 16 450 525 400
25 5 18 5 = 125 450 125
5 14 18 125 350 450
[ ]
8 10 5
= 21 8 21 mod 26
21 12 8
Step – 4:
Converting the cipher text into column vector:
[]
F
I
N
[]
5
8
13
Step – 5:
Decryption of the trigraph:
[ ][ ] [ ][ ]
8 5 10 F 8 5 10 5
21 8 21 I = 21 8 21 8
21 12 8 N 21 12 8 13
[ ]
8∗5+ 5∗8+ 10∗13
= 21∗5+ 8∗8+ 21∗13
21∗5+12∗8+8∗13
[ ][] []
210 2 C
= 442 = 0 mod 26 = A
305 19 T
[ ]
6 24 1
Key: 13 16 10
2 0 17 15
Encryption:
Step - 1:
Converting the plain text into row wise matrix: We split the plaintext into 1*3 matrix
because the given key matrix is a 3*3 matrix and write these as column vectors.
[C A T]
Plain text into numeric row wise matrix: We must convert the plaintext row wise
matrices in the same way that we converted the keyword into the key matrix. Each letter is
replaced by its appropriate number.
[ 2 0 19 ]
Step – 2: Now we must perform some matrix multiplication. We multiply each row wise
matrix by the key matrix in turn. We write row wise matrix first, followed by the key matrix.
Next, we have to take each of these numbers, in our resultant row wise matrix, modulo 26
(remember that means divide by 26 and take the remainder). Finally, we have to convert these
numbers back to letters to get cipher text.
[ ] [ ]
6 24 1 6 24 1
[ C A T ] 13 16 10 = [ 2 0 19 ] 13 16 10
20 17 15 20 17 15
[ ][ ]
18 21 16 450 525 400
25 5 18 5 = 125 450 125
5 14 18 125 350 450
[ ]
8 5 10
= 21 8 21 mod 26
21 12 8
Step – 4:
Converting the cipher text into row wise matrix:
[ C H B]
Step – 5:
Decryption of the row wise matrix:
[ ] [ ]
8 5
10 8 5 10
[ C H B ] 21 8 21 = [ 2 7 1 ] 21 8 21
21 12 8 21 12 8
=[ 184 78 175 ]
=[ 2 0 19 ] mod 26
= [C A T]
So, the plain text is: “CAT”
Solution:
[ H I
Key: L L = 11 11 ] [ 7 8
]
Encryption:
Step - 1:
Converting the plain text into column vector: We split the plaintext into digraphs
because the given key matrix is a 2*2 matrix 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. The plain text is shorter
here, so we have to put “X” as last letter.
=[ 275 ] =[ 15 ] mod 26 = [ P ]
182 0 A
Encryption for Second digraph:
=[ 341 ] =[ 3 ] mod 26 = [ D ]
234 0 A
=[ 253 ] =[ 19 ] mod 26 = [ T ]
165 9 J
=[ 253 ] =[ 19 ] mod 26 = [ T ]
161 5 F
=[ 297 ] =[ 11 ] mod 26 = [ L ]
204 22 W
Encryption for sixth digraph:
=[ 165 ] =[ 9 ] mod 26 = [ J ]
109 5 F
Decryption: To decrypt a cipher text 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 cipher text is split into, take the
results modulo the length of the alphabet, and finally convert the numbers back to letters.
In general, to find the inverse of the key matrix, we perform the calculation below, where K is
the key matrix, d is the determinant of the key matrix and adj(K) is the adjugate matrix of K.
Step – 1:
Determinant of key matrix:
f(x)
x=1 0.54
x=2 1.12
x=3 1.69
x=4 2.26
x=5 2.84
x=6 3.42
x=7 4
Step – 2:
Finding adjugate matrix: For a 2 x 2 matrix, this is fairly straightforward as it is just
moving the elements to different positions and changing a couple of signs. That is, we swap the
top left and bottom right numbers in the key matrix, and change the sign of the top right and
bottom left numbers. Algebraically this is given below.
[a b ] [ d
adj c d = −c
−b
a ]
[ 7 8 ] [ 11 −87 ]
So, adj 11 11 = −11
= [ 15 7 ]mod 26
11 1 8
Step – 3:
The inverse matrix is:
7
[115 178] = [ 105
77 126
49 ]
[ 25 22
= 1 23 mod 26 ]
Step – 4:
Converting the cipher text into column vector:
[ AP ] [ DA ] [ TJ ] [ TF ] [WL ] [ FJ ]
Cipher text into numeric column vector(digraph):
Step – 5:
Decryption of first digraph:
=[ 345 ] =[ 7 ] mod 26 = [ h ]
330 18 s
=[ 69 ] =[ 17 ] mod 26 = [ r ]
66 14 o
Decryption of third digraph:
=[ 446 ] =[ 4 ] mod 26 = [ e ]
643 19 t
=[ 442 ] =[ 0 ] mod 26 = [ a ]
543 23 x
=[ 275 ] =[ 15 ] mod 26 = [ P ]
792 12 m
[H I ] [ 7 8 ]
Key: L L = 11 11
Encryption:
Step - 1:
Converting the plain text into row wise matrix: We split the plaintext into 1*2 matrix
because the given key matrix is a 2*2 matrix and write these as column vectors. That is, in the
first row wise matrix we write the first plaintext letter at the left, and the second letter at the
right. Then we move to the next row wise matrix, where the third plaintext letter goes at the left,
and the fourth at the right. This continues for the whole plaintext.
[ s h] [o r] [t e] [ x a] [ m p] [l e]
Plain text into numeric row wise matrix: We must convert the plaintext row wise
matrices in the same way that we converted the keyword into the key matrix. Each letter is
replaced by its appropriate number.
[ 18 7 ] [ 14 17 ] [ 19 4 ] [ 23 0 ] [ 12 15 ] [ 11 4 ]
Step – 2: Now we must perform some matrix multiplication. We multiply each row wise
matrix by the key matrix in turn. We write row wise matrix first, followed by the key matrix.
Next, we have to take each of these numbers, in our resultant row wise matrix, modulo 26
(remember that means divide by 26 and take the remainder). Finally, we have to convert these
numbers back to letters to get cipher text.
Encryption for first row wise matrix:
Decryption: To decrypt a cipher text 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 cipher text is split into, take the
results modulo the length of the alphabet, and finally convert the numbers back to letters.
In general, to find the inverse of the key matrix, we perform the calculation below, where K is
the key matrix, d is the determinant of the key matrix and adj(K) is the adjugate matrix of K.
Step – 1:
Determinant of key matrix:
f(x)
x=1 0.54
x=2 1.12
x=3 1.69
x=4 2.26
x=5 2.84
x=6 3.42
x=7 4
Step – 2:
Finding adjugate matrix: For a 2 x 2 matrix, this is fairly straightforward as it is just
moving the elements to different positions and changing a couple of signs. That is, we swap the
top left and bottom right numbers in the key matrix, and change the sign of the top right and
bottom left numbers. Algebraically this is given below.
[a b ] [ d
adj c d = −c
−b
a ]
[ 7 8 ] [ 11 −87 ]
So, adj 11 11 = −11
= [ 15 7 ]mod 26
11 18
Step – 3:
The inverse matrix is:
7
[115 187 ] = [ 105
77 126
49 ]
[ 25 22
= 1 23 mod 26 ]
Step – 4:
Converting the cipher text into row wise matrix:
[V N ] [Z N ] [V O ] [F C] [ P B] [ R C ]
Cipher text into numeric row wise matrix:
[ 21 13 ] [ 25 13 ] [ 21 14 ] [ 5 2 ] [ 15 1 ] [ 17 2 ]
Step – 5:
Decryption of first row wise matrix:
[ ]
[ P B ] 25 22 =[ 15 1 ] 25 22
1 23 1 23 [ ]
=[ 15∗25+1∗1 15∗22+1∗23 ]
=[ 376 353 ] =[ 12 15 ] mod 26 = [ m p ]
Solution:
[ ] [ ]
B A C 1 0 2
Key: : K U P =¿ 10 20 15
A B C 0 1 2
Encryption:
Step - 1:
Converting the plain text into column vector: We split the plaintext into trigraphs
because the given key matrix is a 3*3 matrix and write these as column vectors.
[ ] [ ][ ] [ ]
R R T W
E E N X
T A O X
Plain text into numeric column vector(trigraph): We must convert the plaintext
column vectors in the same way that we converted the keyword into the key matrix. Each letter is
replaced by its appropriate number.
[ ] [ ][ ][ ]
17 17 19 22
4 4 13 23
19 0 14 23
Step – 2: Now we must perform some matrix multiplication. We multiply the key matrix by
each column vector in turn. We write the key matrix first, followed by the column vector. Next,
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). Finally, we have to convert these numbers back
to letters to get cipher text.
[ ][ ] [ ][ ]
1 0 2 R 1 0 2 17
10 20 15 E = 10 20 15 4
0 1 2 T 0 1 2 19
[ ]
1∗17+ 0∗4+ 2∗19
= 10∗17+ 20∗4+15∗19
0∗17+1∗4+ 2∗19
[ ][] []
55 3 D
= 535 = 15 mod 26 = P
42 16 Q
[ ]
1∗17+ 0∗4+2∗0
= 10∗17+ 20∗4+1 5∗0
0∗17 +1∗4+2∗0
[ ][] []
17 17 R
= 250 = 16 mod 26 = Q
4 4 E
[ ][ ] [ ][ ]
1 0 2 T 1 0 2 19
10 20 15 N = 10 20 15 13
0 1 2 O 0 1 2 14
[ ]
1∗19+0∗13+2∗14
= 10∗19+20∗13+1 5∗14
0∗19+1∗13+2∗14
[ ][] []
47 21 V
= 660 = 10 mod 26 = K
41 15 P
[ ][ ] [ ][ ]
1 0 2 W 1 0 2 22
10 20 15 X = 10 20 15 23
0 1 2 X 0 1 2 23
[ ]
1∗22+0∗23+2∗23
= 10∗22+20∗23+1 5∗23
0∗22+1∗23+2∗23
[ ][] []
68 16 Q
= 1045 = 11 mod 26 = L
69 17 R
\
Step – 1:
Determinant of key matrix:
| |
1 0 2
10 20 15 = 1*(20*2 – 15*1) – 0 + 2*(10 – 0)
0 1 2
= 25 + 20
= 45 = 19 mod 26
Multiplicative inverse of determinant:
d.d-1 = 1 mod 26
or, 19 x = 1 mod 26
19 x−1
So, 26
f(x)
x=1 0.69
x=2 1.42
x=3 2.15
x=4 2.88
x=5 3.61
x=6 4.34
x=7 5.08
x=8 5.81
x=9 6.54
x = 10 7.27
x = 11 8
So, multiplicative inverse of determinant, d-1 = 11
Step – 2:
Finding adjugate matrix:
[ ]
| 1 2| | 0 2 | | 0 1 |
20 15
+ −
10 15
+
10 20
[ 2]
1 0 2
15 = −| | +| | −|
0 1|
0 2 1 2 1 0
cofactor 10 20
1 2 0 2
0 1
+| 0 2 | −| 1 2 | +| 1 0 |
20 15 10 15 10 20
[ ]
| 1 2|
20 15
+ −|
1 2| |20 15|
0 2
+
0 2
[ 2]
1 0 2
15 = −| | +| | −|
10 15|
10 15 1 2 1 2
adj 10 20
0 2 0 2
0 1
+|10 20| −|1 0| +| 1 0 |
0 1 0 1 10 20
[ ]
25 2 −40
= −20 2 5
10 −1 20
[ ]
25 2 12
= 6 2 5 mod 26
10 25 20
Step – 3:
The inverse matrix is:
[ ][ ]
25 2 12 275 22 132
11 6 2 5 = 66 22 55
10 25 20 110 275 220
[ ]
15 22 2
= 14 22 3 mod 26
6 15 12
Step – 4:
Converting the cipher text into column vector:
[ ] [ ][ ][ ]
D R V Q
P Q K L
Q E P R
[ ] [ ][ ][ ]
3 17 21 16
15 16 10 11
16 4 15 17
Step – 5:
Decryption of first trigraph:
[ ][ ] [ ][ ]
15 22 2 D 15 22 2 3
14 22 3 P = 14 22 3 15
6 15 12 Q 6 15 12 16
[ ]
15∗3+22∗15+ 2∗16
= 14∗3+22∗15+ 3∗16
6∗3+15∗15+12∗16
[ ][] []
407 17 R
= 420 = 4 mod 26 = E
435 19 T
[ ][ ] [ ][ ]
15 22 2 R 15 22 2 17
14 22 3 Q = 14 22 3 16
6 15 12 E 6 15 12 4
[ ]
15∗17+22∗16 +2∗4
= 14∗17+22∗16+3∗4
6∗17+15∗16+12∗4
[ ][] []
615 17 R
= 602 = 4 mod 26 = E
390 0 A
[ ][ ] [ ][ ]
15 22 2 V 15 22 2 21
14 22 3 K = 14 22 3 10
6 15 12 P 6 15 12 15
[ ]
15∗21+ 22∗10+2∗15
= 14∗21+22∗10+3∗15
6∗21+22∗10+ 12∗15
[ ][] []
565 19 T
= 559 = 13 mod 26 = N
456 14 O
[ ][ ] [ ][ ]
15 22 2 Q 15 22 2 16
14 22 3 L = 14 22 3 11
6 15 12 R 6 15 12 17
[ ]
15∗16+ 22∗11+ 2∗17
= 14∗16 +22∗11+ 3∗17
6∗16+ 15∗11+ 12∗17
[ ][] []
516 22 W
= 517 = 23 mod 26 = X
465 23 X
So, the plain text is: “RETREAT NOWXX”. Here, last letter
‘X’ in last 2 places are extra. So, after removing these, the actual plain text is:
“RETREAT NOW”.
4. Plain text: “RETREAT NOW”
Key: BACK UP (3*3)
Again, (Solution converting the plain text into row wise matrix)
Solution:
[ ] [ ]
B A C 1 0 2
Key: : K U P =¿ 10 20 15
A B C 0 1 2
Encryption:
Step - 1:
Converting the plain text into row wise matrix: We split the plaintext into 1*3 matrix
because the given key matrix is a 3*3 matrix and write these as column vectors.
[ R E T ] [ R E A ][ T N O ] [ W X X ]
Plain text into numeric row wise matrix: We must convert the plaintext row wise
matrices in the same way that we converted the keyword into the key matrix. Each letter is
replaced by its appropriate number.
[ 17 4 19 ] [ 17 4 0 ][ 19 13 14 ] [ 22 23 23 ]
Step – 2: Now we must perform some matrix multiplication. We multiply each row wise
matrix by the key matrix in turn. We write row wise matrix first, followed by the key matrix.
Next, we have to take each of these numbers, in our resultant row wise matrix, modulo 26
(remember that means divide by 26 and take the remainder). Finally, we have to convert these
numbers back to letters to get cipher text.
[ ] [ ]
1 0 2 1 0 2
[ R E T ] 10 20 15 = [ 17 4 19 ] 10 20 15
0 1 2 0 1 2
=[ 57 99 132 ]
=[ 5 21 2 ] mod 26
= [F V C]
[ ] [ ]
1 0 2 1 0 2
[R E A ] 10 20 15 = [ 17 4 0 ] 10 20 15
0 1 2 0 1 2
=[ 57 8 0 94 ]
=[ 5 2 1 6 ] mod 26
= [ F C Q]
Encryption for third row wise matrix:
[ ] [ ]
1 0 2 1 0 2
[ T N O ] 10 20 15 = [ 19 13 14 ] 10 20 15
0 1 2 0 1 2
[ ] [ ]
1 0 2 1 0 2
[W X X ] 10 20 15 = [ 22 23 23 ] 10 20 15
0 1 2 0 1 2
\
Step – 1:
Determinant of key matrix:
| |
1 0 2
10 20 15 = 1*(20*2 – 15*1) – 0 + 2*(10 – 0)
0 1 2
= 25 + 20
= 45 = 19 mod 26
Multiplicative inverse of determinant:
d.d-1 = 1 mod 26
or, 19 x = 1 mod 26
19 x−1
So, 26
f(x)
x=1 0.69
x=2 1.42
x=3 2.15
x=4 2.88
x=5 3.61
x=6 4.34
x=7 5.08
x=8 5.81
x=9 6.54
x = 10 7.27
x = 11 8
[ ]
|20 15
1 2 | −|
+
10 15
0 2 | +|
0 1|
10 20
[ 2]
1 0 2
15 = −| | +| | −|
0 1|
0 2 1 2 1 0
cofactor 10 20 1 2 0 2
0 1
+| 0 2 | −| 1 2 | +| 1 0 |
20 15 10 15 10 20
[ ]
| 1 2 | |1 2| |20 15|
20 15
+ −
0 2
+
0 2
[ 2]
1 0 2
15 = −| | +| | −|
15|
10 15 1 2 1 2
adj 10 20 0 2 0 2 10
0 1
+|10 20| −|1 0| +| 1 0 |
0 1 0 1 10 20
[ ]
25 2 −40
= −20 2 5
10 −1 20
[ ]
25 2 12
= 6 2 5 mod 26
10 25 20
Step – 3:
The inverse matrix is:
[ ][ ]
25 2 12 275 22 132
11 6 2 5 = 66 22 55
10 25 20 110 275 220
[ ]
15 22 2
= 14 22 3 mod 26
6 15 12
Step – 4:
Converting the cipher text into row wise matrix:
[ F V C ] [ F C Q ][ T O B ] [ S P T ]
Cipher text into numeric row wise matrix:
[ 5 21 2 ] [ 5 2 1 6 ] [ 19 14 1 ] [ 18 15 19 ]
Step – 5:
Decryption of first row wise matrix:
[ ] [ ]
15 22 2 15 22 2
[ F V C ] 14 22 3 = [ 5 21 2 ] 14 22 3
6 15 12 6 15 12
=[ 381 602 97 ]
=[ 17 4 19 ] mod 26
= [R E T]
[ ] [ ]
15 22 2 15 22 2
[ F C Q ] 14 22 3 = [ 5 2 1 6 ] 14 22 3
6 15 12 6 15 12
[ ] [ ]
15 22 2 15 22 2
[ T O B ] 14 22 3 = [ 19 14 1 ] 14 22 3
6 15 12 6 15 12
=[ 487 741 92 ]
=[ 19 13 14 ] mod 26
= [T N O ]
[ ] [ ]
15 22 2 15 22 2
[ S P T ] 14 22 3 = [ 18 15 19 ] 14 22 3
6 15 12 6 15 12
So, the plain text is: “RETREAT NOWXX”. Here, last letter
‘X’ in last 2 places are extra. So, after removing these, the actual plain text is:
“RETREAT NOW”.
Solution:
[ ][ ]
A L P 0 11 15
Key: H A B =7 0 1
E T A 4 19 0
Encryption:
Step - 1:
Converting the plain text into column vector: We split the plaintext into trigraphs
because the given key matrix is a 3*3 matrix and write these as column vectors.
[ ] [ ][ ]
W R A
E E F
A S E
Plain text into numeric column vector(trigraph): We must convert the plaintext
column vectors in the same way that we converted the keyword into the key matrix. Each letter is
replaced by its appropriate number.
[ ] [ ][ ]
22 17 0
4 4 5
0 18 4
Step – 2: Now we must perform some matrix multiplication. We multiply the key matrix by
each column vector in turn. We write the key matrix first, followed by the column vector. Next,
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). Finally, we have to convert these numbers back
to letters to get cipher text.
[ ][ ] [ ][ ]
0 11 15 W 0 11 15 22
7 0 1 E = 7 0 1 4
4 19 0 A 4 19 0 0
[ ]
0∗22+ 11∗4+15∗0
= 7∗22+0∗4+1∗0
4∗22+19∗4+0∗0
[ ][ ] []
44 18 S
= 154 = 24 mod 26 = Y
164 8 I
[ ][ ] [ ][ ]
0 11 15 R 0 11 15 17
7 0 1 E= 7 0 1 4
4 19 0 S 4 19 0 18
[ ]
0∗17 +11∗4 +15∗18
= 7∗17+ 0∗4+1∗18
4∗17 +19∗4+ 0∗18
[ ][] []
314 2 C
= 137 = 7 mod 26 = H
144 14 O
[ ][ ] [ ][ ]
0 11 15 A 0 11 15 0
7 0 1 F = 7 0 1 5
4 19 0 E 4 19 0 4
[ ]
0∗0+11∗5+15∗4
= 7∗0+ 0∗5+1∗4
4∗0+19∗5+ 0∗4
[ ][ ] []
115 11 L
= 4 = 4 mod 26 = E
95 17 R
Decryption: To decrypt a cipher text 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 cipher text is split into, take the
results modulo the length of the alphabet, and finally convert the numbers back to letters.
In general, to find the inverse of the key matrix, we perform the calculation below, where K is
the key matrix, d is the determinant of the key matrix and adj(K) is the adjugate matrix of K.
\
Step – 1:
Determinant of key matrix:
| |
0 11 1 5
7 0 1 = 0 – 11*(0 - 4) + 15*(133 – 0)
4 19 0
= 0 + 44 +1995
= 2039
= 11 mod 26
[ ]
+ 0
19 | 10| −|1911 105| +|110 115|
[ ]
0 11 15
7
adj 7 0 1 = − 4
4 19 0
| 10| +|40 105| −|07 151 |
+7
4 | 190 | −|04 1911| +|70 110 |
[ ]
−19 285 11
= 4 −60 105
133 44 −77
[ ]
7 25 11
= 4 1 8 1 mod 26
3 18 1
Step – 3:
The inverse matrix is:
[ ][ ]
7 25 11 133 475 209
19 4 18 1 = 76 342 19
3 18 1 57 342 19
[ ]
3 7 1
= 24 4 19 mod 26
5 4 19
Step – 4:
Converting the cipher text into column vector:
[ ] [ ][ ]
S C L
Y H E
I O R
[ ] [ ][ ]
18 2 11
24 7 4
8 1 4 17
Step – 5:
Decryption of first trigraph:
[ ][ ] [ ][ ]
3 7 1 S 3 7 1 18
24 4 19 Y = 24 4 19 24
5 4 19 I 5 4 19 8
[ ]
3∗18+7∗24+ 1∗8
= 24∗18+4∗24+19∗8
5∗18+4∗24 +19∗8
[ ][] []
230 22 W
= 680 = 4 mod 26 = E
338 0 A
[ ]
3∗2+7∗7+1∗14
= 24∗2+4∗7 +19∗14
5∗2+ 4∗7+19∗14
[ ][ ] []
69 17 R
= 342 = 4 mod 26 = E
304 18 S
[ ][ ] [ ][ ]
3 7 1 L 3 7 1 11
24 4 19 E = 24 4 19 4
5 4 19 R 5 4 19 17
[ ]
3∗11+7∗4+1∗17
= 24∗11+ 4∗4 +19∗17
5∗11+4∗4+19∗17
[ ] [] []
78 0 A
= 603 = 5 mod 26 = F
394 4 E
[ ][ ]
A L P 0 11 15
Key: H A B =7 0 1
E T A 4 19 0
Encryption:
Step - 1:
Converting the plain text into row wise matrix: We split the plaintext into 1*3 matrix
because the given key matrix is a 3*3 matrix and write these as row vectors.
[ W E A ] [ R E S ][ A F E ]
Plain text into numeric row wise matrix: We must convert the plaintext row wise
matrices in the same way that we converted the keyword into the key matrix. Each letter is
replaced by its appropriate number.
[ 22 4 0 ] [ 17 4 18 ] [ 0 5 4 ]
Step – 2: Now we must perform some matrix multiplication. We multiply each row wise
matrix by the key matrix in turn. We write row wise matrix first, followed by the key matrix.
Next, we have to take each of these numbers, in our resultant row wise matrix, modulo 26
(remember that means divide by 26 and take the remainder). Finally, we have to convert these
numbers back to letters to get cipher text.
[ ] [ ]
0 11 1 5 0 11 15
[W E A] 7 0 1 = [ 22 4 0 ] 7 0 1
4 19 0 4 19 0
=[ 28 242 334 ]
=[ 2 8 22 ] mod 26
= [C I W ]
[ ] [ ]
0 11 15 0 11 15
[R E S ] 7 0 1 = [ 17 4 18 ] 7 0 1
4 19 0 4 19 0
[ ] [ ]
0 11 15 0 11 15
[A F E] 7 0 1 = [0 5 4] 7 0 1
4 19 0 4 19 0
=[ 51 76 5 ]
=[ 25 24 5 ] mod 26
= [Z Y F]
So, the cipher text is: “CIWWJZZYF”
Decryption: To decrypt a cipher text 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 cipher text is split into, take the
results modulo the length of the alphabet, and finally convert the numbers back to letters.
In general, to find the inverse of the key matrix, we perform the calculation below, where K is
the key matrix, d is the determinant of the key matrix and adj(K) is the adjugate matrix of K.
\
Step – 1:
Determinant of key matrix:
| |
0 11 15
7 0 1 = 0 – 11*(0 - 4) + 15*(133 – 0)
4 19 0
= 0 + 44 +1995
= 2039
= 11 mod 26
Multiplicative inverse of determinant:
d.d-1 = 1 mod 26
or, 11 x = 1 mod 26
11 x−1
So, 26
[ ]
| 0 1
19 0 |
+ −|
11 15
19 0 | +|
0 1|
11 15
[ 0]
0 11 15
1 = −| | +| | −|
7 1|
7 1 0 15 0 15
adj 7 0 4 0 4 0
4 19
+|7 0 | −|0 11| +|0 11|
4 19 4 19 7 0
[ ]
−19 285 11
= 4 −60 105
133 44 −77
[ ]
7 25 11
= 4 18 1 mod 26
3 18 1
Step – 3:
The inverse matrix is:
[ ][ ]
7 25 11 133 475 209
19 4 18 1 = 76 342 19
3 18 1 57 342 19
[ ]
3 7 1
= 24 4 19 mod 26
5 4 19
Step – 4:
Converting the cipher text into row wise matrix:
[ C I W ][ W J Z ] [ Z Y F ]
Cipher text into numeric row wise matrix:
[ 2 8 22 ] [ 22 9 25 ][ 25 24 5 ]
Step – 5:
Decryption of first row wise matrix:
[ ] [ ]
3 7 1 3 7 1
[ C I W ] 24 4 19 =[ 2 8 22 ] 24 4 19
5 4 19 5 4 19
[ ] [ ]
3 7 1 3 7 1
[W J Z ] 24 4 19 = [ 22 9 25 ] 24 4 19
5 4 19 5 4 19
[ ] [ ]
3 7 1 3 7 1
[Z Y F ] 24 4 19 = [ 25 24 5 ] 24 4 19
5 4 19 5 4 19
[8 1]
Key: 19 14
Solution:
Encryption:
Step - 1:
Converting the plain text into column vector: We split the plaintext into digraphs
because the given key matrix is a 2*2 matrix 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. The plain text is shorter
here, so we have to put “X” as last letter.
[ BE ] [ HE ] [ RE ] [ AT ][ ES ] [ VE ][ NX ]
Plain text into numeric column vector(trigraph): We must convert the plaintext
column vectors in the same way that we converted the keyword into the key matrix. Each letter is
replaced by its appropriate number.
=[ 75 ] =[ 23 ] mod 26 = [ X ]
12 12 M
=[ 18 9 ] =[ 7 ] mod 26 = [ H ]
60 8 I
=[ 379 ] =[ 15 ] mod 26 = [ P ]
140 10 K
=[ 398 ] =[ 8 ] mod 26 = [ I ]
148 18 S
[ ][ ] [
8 1 V
19 14 E =
8 1 21
19 14 4 ][ ]
=[ 19∗21+14∗4 ]
8∗21+1∗4
=[ 455 ] =[ 13 ] mod 26 = [ N ]
172 16 Q
=[ 569 ] =[ 23 ] mod 26 = [ X ]
127 23 X
Decryption: To decrypt a cipher text 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 cipher text is split into, take the
results modulo the length of the alphabet, and finally convert the numbers back to letters.
In general, to find the inverse of the key matrix, we perform the calculation below, where K is
the key matrix, d is the determinant of the key matrix and adj(K) is the adjugate matrix of K.
Step – 1:
Determinant of key matrix:
f(x)
x=1 0.54
x=2 1.12
x=3 1.69
x=4 2.27
x=5 2.85
x=6 3.42
x=7 4
[a b ] [ d
adj c d = −c
−b
a ]
[ 8 1 ] [ 14 −18 ]
So, adj 19 14 = −19
= [ 7 8 ]mod 26
14 25
Step – 3:
The inverse matrix is:
7
[147 258 ]= [ 9849 175
56 ]
= [ 23 4 ] mod 26
20 19
Step – 4:
Converting the cipher text into column vector:
[ MX ] [ HI ] [ KP ] [ TG ][ SI ] [ QN ][ XX ]
Cipher text into numeric column vector(digraph):
=[ 368 ] =[ 4 ] mod 26 = [ E ]
677 1 B
=[ 212 ] =[ 4 ] mod 26 = [ E ]
293 7 H
=[ 290 ] =[ 4 ] mod 26 = [ E ]
485 17 R
=[ 446 ] =[ 4 ] mod 26 = [ E ]
512 18 S
=[ 420 ] =[ 4 ] mod 26 = [ E ]
567 21 V
=[ 621 ] =[ 23 ] mod 26 = [ X ]
897 13 N
So, the plain text is: “BE HERE AT SEVENX”. Here last
letter X is dummy, So the final plain text is: “BE HERE AT SEVEN”.
Solution:
Encryption:
Step - 1:
Converting the plain text into row wise matrix: We split the plaintext into 1*2 matrix
because the given key matrix is a 2*2 matrix and write these as column vectors. That is, in the
first row wise matrix we write the first plaintext letter at the left, and the second letter at the
right. Then we move to the next row wise matrix, where the third plaintext letter goes at the left,
and the fourth at the right. This continues for the whole plaintext. The plain text is shorter here,
so we have to put “X” as last letter.
[B E] [H E] [R E] [ A T] [S E] [V E] [ N X]
Plain text into numeric row wise matrix: We must convert the plaintext row wise
matrices in the same way that we converted the keyword into the key matrix. Each letter is
replaced by its appropriate number.
[ 1 4 ] [ 7 4 ] [ 17 4 ] [ 0 19 ] [ 18 4 ] [ 21 4 ] [ 13 23 ]
Step – 2: Now we must perform some matrix multiplication. We multiply each row wise
matrix by the key matrix in turn. We write row wise matrix first, followed by the key matrix.
Next, we have to take each of these numbers, in our resultant row wise matrix, modulo 26
(remember that means divide by 26 and take the remainder). Finally, we have to convert these
numbers back to letters to get cipher text.
Decryption: To decrypt a cipher text 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 cipher text is split into, take the
results modulo the length of the alphabet, and finally convert the numbers back to letters.
In general, to find the inverse of the key matrix, we perform the calculation below, where K is
the key matrix, d is the determinant of the key matrix and adj(K) is the adjugate matrix of K.
Step – 1:
Determinant of key matrix:
f(x)
x=1 0.54
x=2 1.12
x=3 1.69
x=4 2.27
x=5 2.85
x=6 3.42
x=7 4
Step – 2:
Finding adjugate matrix: For a 2 x 2 matrix, this is fairly straightforward as it is just
moving the elements to different positions and changing a couple of signs. That is, we swap the
top left and bottom right numbers in the key matrix, and change the sign of the top right and
bottom left numbers. Algebraically this is given below.
[a b ] [ d
adj c d = −c
−b
a ]
[ 8 1 ] [ 14 −18 ]
So, adj 19 14 = −19
= [ 7 8 ]mod 26
14 25
Step – 3:
The inverse matrix is:
7
[147 258 ]= [ 9849 175
56 ]
[ 20 19
= 23 4 mod 26 ]
Step – 4:
Converting the cipher text into row wise matrix:
[G F] [ C L] [E V ] [ X G] [ M W ] [ K Z] [Y X]
Cipher text into numeric row wise matrix:
[ 6 5 ] [ 2 11 ] [ 4 2 1 ] [ 23 6 ] [ 12 22 ] [ 10 25 ][ 21 23 ]
Step – 5:
Decryption of first row wise matrix:
[ ]
[ M W ] 20 19 =[ 12 22 ] 20 19
23 4 23 4 [ ]
=[ 12∗20+ 22∗23 12∗19+22∗4 ]
=[ 7 46 316 ]=[ 18 4 ] mod 26 = [ S E ]
So, the plain text is: “BE HERE AT SEVENX”. Here last
letter X is dummy, So the final plain text is: “BE HERE AT SEVEN”.
7. Plain text: “I WILL BE LATE”
Key: 19 14[8 1]
(Solution converting the plain text into column vector)
Solution:
Encryption:
Step - 1:
Converting the plain text into column vector: We split the plaintext into digraphs
because the given key matrix is a 2*2 matrix 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. The plain text is shorter
here, so we have to put “X” as last letter.
[ WI ] [ LI ] [ BL ] [ EL ][ TA ] [ EX ]
Plain text into numeric column vector(trigraph): We must convert the plaintext
column vectors in the same way that we converted the keyword into the key matrix. Each letter is
replaced by its appropriate number.
=[ 460 ] =[ 18 ] mod 26 = [ S ]
86 8 I
=[ 306 ] =[ 20 ] mod 26 = [ U ]
75 23 X
=[ 223 ] =[ 15 ] mod 26 = [ P ]
89 11 L
=[ 230 ] =[ 22 ] mod 26 = [ W ]
43 17 R
=[ 266 ] =[ 6 ] mod 26 = [ G ]
19 19 T
=[ 398 ] =[ 8 ] mod 26 = [ I ]
55 3 D
Decryption: To decrypt a cipher text 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 cipher text is split into, take the
results modulo the length of the alphabet, and finally convert the numbers back to letters.
In general, to find the inverse of the key matrix, we perform the calculation below, where K is
the key matrix, d is the determinant of the key matrix and adj(K) is the adjugate matrix of K.
Step – 1:
Determinant of key matrix:
f(x)
x=1 0.54
x=2 1.12
x=3 1.69
x=4 2.27
x=5 2.85
x=6 3.42
x=7 4
Step – 2:
Finding adjugate matrix: For a 2 x 2 matrix, this is fairly straightforward as it is just
moving the elements to different positions and changing a couple of signs. That is, we swap the
top left and bottom right numbers in the key matrix, and change the sign of the top right and
bottom left numbers. Algebraically this is given below.
[a b ] [ d
adj c d = −c
−b
a ]
[ 8 1 ] [ 14 −18 ]
So, adj 19 14 = −19
= [ 7 8 ]mod 26
14 25
Step – 3:
The inverse matrix is:
7
[147 258 ]= [ 9849 175
56 ]
= [ 23 4 ] mod 26
20 19
Step – 4:
Converting the cipher text into column vector:
[ SI ] [ UX ] [ LP ] [ WR ][ GT ] [ DI ]
Cipher text into numeric column vector(digraph):
=[ 256 ] =[ 22 ] mod 26 = [ W ]
502 8 I
=[ 313 ] =[ 1 ] mod 26 = [ B ]
505 11 L
[ ][ ] [
3 17 I
8 25 G
=
3 17 19
8 25 6 ][ ]
[ 20∗19+ 19∗6 ]
= 23∗19+ 4∗6
=[ 461 ] =[ 19 ] mod 26 = [ T ]
494 0 A
So, the plain text is: “I WILL BE LATEX”. Here last letter X
is dummy, So the final plain text is: “I WILL BE LATE”.
[8 1]
Key: 19 14
Again, (Solution converting the plain text into row wise matrix)
Solution:
Encryption:
Step - 1:
Converting the plain text into row wise matrix: We split the plaintext into 1*2 matrix
because the given key matrix is a 2*2 matrix and write these as column vectors. That is, in the
first row wise matrix we write the first plaintext letter at the left, and the second letter at the
right. Then we move to the next row wise matrix, where the third plaintext letter goes at the left,
and the fourth at the right. This continues for the whole plaintext. The plain text is shorter here,
so we have to put “X” as last letter.
[I W ] [ I L] [ L B] [ E L] [ A T] [E X]
Plain text into numeric row wise matrix: We must convert the plaintext row wise
matrices in the same way that we converted the keyword into the key matrix. Each letter is
replaced by its appropriate number.
[ 8 22 ] [ 8 11] [ 11 1 ] [ 4 11 ] [ 0 19 ] [ 4 23 ]
Step – 2: Now we must perform some matrix multiplication. We multiply each row wise
matrix by the key matrix in turn. We write row wise matrix first, followed by the key matrix.
Next, we have to take each of these numbers, in our resultant row wise matrix, modulo 26
(remember that means divide by 26 and take the remainder). Finally, we have to convert these
numbers back to letters to get cipher text.
Decryption: To decrypt a cipher text 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 cipher text is split into, take the
results modulo the length of the alphabet, and finally convert the numbers back to letters.
In general, to find the inverse of the key matrix, we perform the calculation below, where K is
the key matrix, d is the determinant of the key matrix and adj(K) is the adjugate matrix of K.
Step – 1:
Determinant of key matrix:
f(x)
x=1 0.54
x=2 1.12
x=3 1.69
x=4 2.27
x=5 2.85
x=6 3.42
x=7 4
Step – 2:
Finding adjugate matrix: For a 2 x 2 matrix, this is fairly straightforward as it is just
moving the elements to different positions and changing a couple of signs. That is, we swap the
top left and bottom right numbers in the key matrix, and change the sign of the top right and
bottom left numbers. Algebraically this is given below.
[a b ] [ d
adj c d = −c
−b
a ]
[ 8 1 ] [ 14 −18 ]
So, adj 19 14 = −19
= [ 7 8 ]mod 26
14 25
Step – 3:
The inverse matrix is:
7
[147 258 ]= [ 9849 175
56 ]
= [ 23 4 ] mod 26
20 19
Step – 4:
Converting the cipher text into row wise matrix:
[O E] [N G] [ D Z] [H C] [ X G] [B O]
Cipher text into numeric row wise matrix:
[ 14 4 ] [ 13 6 ] [ 3 25 ] [ 7 2 ] [ 23 6 ] [ 1 14 ]
Step – 5:
Decryption of first row wise matrix:
[ ]
[ X G ] 20 19 =[ 23 6 ] 20 19
23 4 23 4 [ ]
=[ 23∗20+6∗23 23∗19+6∗4 ]
=[ 598 461 ]=[ 0 19 ] mod 26 = [ A T ]
Solution:
Encryption:
Step - 1:
Converting the plain text into column vector: We split the plaintext into trigraphs
because the given key matrix is a 3*3 matrix and write these as column vectors.
[ ] [ ][ ][ ] [ ]
B N M T N
E T E T X
O I A E X
Plain text into numeric column vector(trigraph): We must convert the plaintext
column vectors in the same way that we converted the keyword into the key matrix. Each letter is
replaced by its appropriate number.
[ ] [ ][ ][ ] [ ]
1 13 12 19 13
4 19 4 19 23
14 8 0 4 23
Step – 2: Now we must perform some matrix multiplication. We multiply the key matrix by
each column vector in turn. We write the key matrix first, followed by the column vector. Next,
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). Finally, we have to convert these numbers back
to letters to get cipher text.
[ ][ ] [ ][ ]
11 6 8 B 11 6 8 1
6 3 14 E = 6 3 14 4
24 0 9 O 24 0 9 1 4
[ ]
11∗1+6∗4+8∗1 4
= 0∗1+ 3∗4+1 4∗1 4
2 4∗1+0∗4 +9∗1 4
[ ][] []
147 17 R
= 208 = 0 mod 26 = A
150 20 U
[ ][ ] [ ][ ]
11 6 8 N 11 6 8 13
6 3 14 T = 6 3 14 19
24 0 9 I 24 0 9 8
[ ]
11∗13+6∗19+8∗8
= 0∗13+3∗19+ 14∗8
2 4∗13+0∗19+19∗8
[ ][] []
321 9 J
= 169 = 13 mod 26 = N
384 20 U
[ ][ ] [ ][ ]
11 6 8 M 11 6 8 12
6 3 14 E = 6 3 14 4
24 0 9 A 24 0 9 0
[ ]
11∗12+6∗4+8∗0
= 0∗12+ 3∗4+14∗0
24∗12+0∗4+ 9∗0
[ ][] []
156 0 A
= 12 = 12 mod 26 = M
288 2 C
[ ][ ] [ ][ ]
11 6 8 T 11 6 8 19
0 3 14 T = 0 3 14 19
24 0 9 E 24 0 9 4
[ ]
11∗19+6∗19+8∗4
= 0∗19+ 3∗19+14∗4
24∗19+0∗19+9∗1 4
[ ][] []
355 17 R
= 113 = 9 mod 26 = J
492 24 Y
[ ][ ] [ ][ ]
11 6 8 N 11 6 8 13
0 3 14 X = 0 3 14 23
24 0 9 X 24 0 9 23
[ ]
11∗13+6∗23+ 8∗23
= 0∗13+3∗23+14∗23
24∗13+0∗23+9∗23
[ ][] []
465 23 X
= 391 = 1 mod 26 = B
519 25 Z
Decryption: To decrypt a cipher text 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 cipher text is split into, take the
results modulo the length of the alphabet, and finally convert the numbers back to letters.
In general, to find the inverse of the key matrix, we perform the calculation below, where K is
the key matrix, d is the determinant of the key matrix and adj(K) is the adjugate matrix of K.
Step – 1:
Determinant of key matrix:
| |
11 6 8
0 3 14 = 11*(3*9 – 14*0) – 6*(0*9 -14*24) + 8*(0*0 – 3*24)
24 0 9
= 1737
= 21 mod 26
f(x)
x=1 0.7692
x=2 1.5769
x=3 2.3846
x=4 3.1923
x=5 4
Step – 2:
Finding adjugate matrix:
[ ]
|0 9 | |2 4 9 | |2 4 0|
3 14
+−
0 14
+
0 3
[ 9]
11 6 8
14 = −| | +| | −|
2 4 0|
6 8 11 8 11 6
cofactor 0 3
0 9 24 9
24 0
+|6 8 | −|11 8 | +|11 6|
3 14 0 14 0 3
[ ]
|0 9|
3 14
+ −|
0 9|
6 8
+|
3 14|
6 8
[ 9]
11 6 8
14 = −| | +| | −|
0 14|
0 14 11 8 11 8
adj 0 3 24 9 24 9
24 0
+| 0 3| −| 11 6| +|11 6|
24 0 24 0 0 3
[ ]
27 −54 60
= 336 −93 −154
−72 144 33
[ ]
1 24 8
= 24 11 2 mod 26
6 14 7
Step – 3:
The inverse matrix is:
[ ][ ]
1 24 8 5 120 40
5 24 11 2 = 120 55 10
6 14 7 30 70 35
[ ]
5 16 14
= 16 3 10 mod 26
4 18 9
Step – 4:
Converting the cipher text into column vector:
[ ] [ ][ ][ ] [ ]
B N M T N
E T E T X
O I A E X
Step – 5:
Decryption of first trigraph:
[ ][ ] [ ][ ]
5 16 14 R 5 16 14 17
16 3 10 A = 16 3 10 0
4 18 9 U 4 18 9 20
[ ]
5∗17+ 16∗0+14∗20
= 16∗17+3∗0+10∗20
4∗17+18∗0+ 9∗20
[ ][ ] []
637 1 B
= 472 = 4 mod 26 = E
248 14 O
[ ][ ] [ ][ ]
5 16 14 J 5 16 14 9
16 3 10 N = 16 3 10 13
4 18 9 U 4 18 9 20
[ ]
5∗9+16∗13+14∗20
= 16∗9+3∗13+10∗20
4∗9+18∗13+9∗20
[ ][] []
533 13 N
= 383 = 19 mod 26 = T
450 8 I
[ ][ ] [ ][ ]
5 16 14 A 5 16 14 0
16 3 10 M = 16 3 10 12
4 18 9 C 4 18 9 2
[ ]
5∗0+ 16∗12+14∗2
= 16∗0+3∗12+ 10∗2
4∗0+18∗12+9∗2
[ ][] []
220 12 M
= 56 = 4 mod 26 = E
234 0 A
[ ][ ] [ ][ ]
5 16 14 R 5 16 14 17
16 3 10 J = 16 3 10 9
4 18 9 Y 4 18 9 24
[ ]
5∗17+ 16∗9+14∗24
= 16∗17+3∗9+10∗24
4∗17+18∗9+ 9∗24
[ ][] []
565 19 T
= 539 = 19 mod 26 = T
446 4 E
[ ][ ] [ ][ ]
5 16 14 X 5 16 14 23
16 3 10 B = 16 3 10 1
4 18 9 Z 4 18 9 25
[ ]
5∗23+ 16∗1+14∗25
= 16∗23+3∗1+ 10∗25
4∗23+18∗1+9∗25
[ ][] []
481 13 N
= 621 = 23 mod 26 = X
335 23 X
Again, (Solution converting the plain text into row wise matrix)
Solution:
Encryption:
Step - 1:
Converting the plain text into row wise matrix: We split the plaintext into 1*3 matrix
because the given key matrix is a 3*3 matrix and write these as column vectors. [B E O]
[ N T I ] [ M E A ] [ T T E ][ N X X ]
Plain text into numeric row wise matrix: We must convert the plaintext row wise
matrices in the same way that we converted the keyword into the key matrix. Each letter is
replaced by its appropriate number.
[ 1 4 1 4 ] [ 13 19 8 ][ 12 4 0 ] [ 19 19 4 ] [ 13 23 23 ]
Step – 2: Now we must perform some matrix multiplication. We multiply each row wise
matrix by the key matrix in turn. We write row wise matrix first, followed by the key matrix.
Next, we have to take each of these numbers, in our resultant row wise matrix, modulo 26
(remember that means divide by 26 and take the remainder). Finally, we have to convert these
numbers back to letters to get cipher text.
[ ] [ ]
11 6 8 11 6 8
[B E O] 0 3 14 = [ 1 4 1 4 ] 0 3 14
24 0 9 24 0 9
=[ 347 18 190 ]
=[ 9 18 8 ] mod 26
= [J S I ]
Encryption for Second row wise matrix:
[ ] [ ]
11 6 8 11 6 8
[N T I] 0 3 14 = [ 13 19 8 ] 0 3 14
24 0 9 24 0 9
[ ] [ ]
11 6 8 11 6 8
[M E A ] 0 3 14 = [ 12 4 0 ] 0 3 14
24 0 9 24 0 9
=[ 132 84 152 ]
=[ 2 6 22 ] mod 26
= [C G W ]
[ ] [ ]
11 6 8 11 6 8
[T T E ] 0 3 14 = [ 19 19 4 ] 0 3 14
24 0 9 24 0 9
Decryption: To decrypt a cipher text 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 cipher text is split into, take the
results modulo the length of the alphabet, and finally convert the numbers back to letters.
In general, to find the inverse of the key matrix, we perform the calculation below, where K is
the key matrix, d is the determinant of the key matrix and adj(K) is the adjugate matrix of K.
Step – 1:
Determinant of key matrix:
| |
11 6 8
0 3 14 = 11*(3*9 – 14*0) – 6*(0*9 -14*24) + 8*(0*0 – 3*24)
24 0 9
= 1737
= 21 mod 26
Step – 2:
Finding adjugate matrix:
[ ]
+3
0 | 149 | −|240 149 | +|240 30|
[ ]
11 6 8
cofactor 0 3 14 = −
24 0 9
6
0 | 89| +|2411 89| −|1124 60|
+6
3 | 148 | −|110 148 | +|110 63|
[ ]
+3
0 | 149 | −|60 89| +|63 148 |
[ ]
11 6 8
0
adj 0 3 14 = − 24
24 0 9
| 149 | +|1124 89| −|110 148 |
+ 0
24 | 30| −|1124 60| +|110 63|
[ ]
27 −54 60
= 336 −93 −154
−72 144 33
[ ]
1 24 8
= 24 11 2 mod 26
6 14 7
Step – 3:
The inverse matrix is:
[ ][ ]
1 24 8 5 120 40
5 24 11 2 = 120 55 10
6 14 7 30 70 35
[ ]
5 16 14
= 16 3 10 mod 26
4 18 9
Step – 4:
Converting the cipher text into row wise matrix:
[ J S I ][ X F A ][ C G W ] [ T P M ] [ T R J ]
Cipher text into numeric row wise matrix:
[ 9 18 8 ] [ 23 5 0 ][ 2 6 22 ] [ 19 15 12 ] [ 19 17 9 ]
Step – 5:
Decryption of first row wise matrix:
[ ] [ ]
5 16 14 5 16 14
[ J S I ] 16 3 10 = [ 9 18 8 ] 16 3 10
4 18 9 4 18 9
[ ] [ ]
5 16 14 5 16 14
[ X F A ] 16 3 10 = [ 23 5 0 ] 16 3 10
4 18 9 4 18 9
[ ] [ ]
5 16 14 5 16 14
[ C G W ] 16 3 10 = [ 2 6 22 ] 16 3 10
4 18 9 4 18 9
[ ] [ ]
5 16 14 5 16 14
[ T P M ] 16 3 10 = [ 19 15 12 ] 16 3 10
4 18 9 4 18 9
[ ] [ ]
5 16 14 5 16 14
[T R J ] 16 3 10 = [ 19 17 9 ] 16 3 10
4 18 9 4 18 9
[ ]
11 6 8
Key: 0 3 14
24 0 9
Solution:
Encryption:
Step - 1:
Converting the plain text into column vector: We split the plaintext into trigraphs
because the given key matrix is a 3*3 matrix and write these as column vectors.
[ ] [ ][ ] [ ][ ]
T E E O M
H E N Y A
R T T U X
Plain text into numeric column vector(trigraph): We must convert the plaintext
column vectors in the same way that we converted the keyword into the key matrix. Each letter is
replaced by its appropriate number.
[ ] [ ][ ] [ ][ ]
19 4 4 14 12
7 4 13 24 0
17 19 19 20 23
Step – 2: Now we must perform some matrix multiplication. We multiply the key matrix by
each column vector in turn. We write the key matrix first, followed by the column vector. Next,
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). Finally, we have to convert these numbers back
to letters to get cipher text.
[ ]
11∗1 9+6∗7+ 8∗1 7
= 0∗1 9+ 3∗7 +14∗17
24∗1 9+0∗7+9∗1 7
[ ][] []
387 23 X
= 259 = 25 mod 26 = Z
609 11 L
[ ][ ] [ ][ ]
11 6 8 E 11 6 8 4
6 3 14 E = 6 3 14 4
24 0 9 T 24 0 9 19
[ ]
11∗4+6∗4+8∗19
= 0∗4 +3∗4+14∗19
24∗4 +0∗4 +9∗19
[ ][ ] []
220 12 M
= 278 = 18 mod 26 = S
267 7 H
[ ][ ] [ ][ ]
11 6 8 E 11 6 8 4
6 3 14 N = 6 3 14 13
24 0 9 T 24 0 9 19
[ ]
11∗4+6∗13+8∗19
= 0∗4 +3∗13+ 14∗19
24∗4 +0∗13+9∗19
[ ][] []
274 14 O
= 305 = 19 mod 26 = T
267 7 H
[ ]
11∗14 +6∗24+8∗20
= 0∗14+3∗24+ 14∗20
24∗14+ 0∗24 +9∗20
[ ][] []
458 16 Q
= 352 = 14 mod 26 = O
516 22 W
[ ][ ] [ ][ ]
11 6 8 M 11 6 8 12
0 3 14 A = 0 3 14 0
24 0 9 X 24 0 9 23
[ ]
11∗12+6∗0+ 8∗23
= 0∗12+ 3∗0+ 14∗23
24∗12+0∗0+9∗23
[ ][ ] []
316 4 E
= 322 = 10 mod 26 = K
495 1 B
Decryption: To decrypt a cipher text 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 cipher text is split into, take the
results modulo the length of the alphabet, and finally convert the numbers back to letters.
In general, to find the inverse of the key matrix, we perform the calculation below, where K is
the key matrix, d is the determinant of the key matrix and adj(K) is the adjugate matrix of K.
Step – 1:
Determinant of key matrix:
| |
11 6 8
0 3 14 = 11*(3*9 – 14*0) – 6*(0*9 -14*24) + 8*(0*0 – 3*24)
24 0 9
= 1737
= 21 mod 26
f(x)
x=1 0.7692
x=2 1.5769
x=3 2.3846
x=4 3.1923
x=5 4
Step – 2:
Finding adjugate matrix:
[ ]
|3 14
0 9 |
+ −|
0 14
24 9 | +|
24 0|
0 3
[ 9]
11 6 8
14 = −| | +| | −|
24 0|
6 8 11 8 11 6
cofactor 0 3
0 9 24 9
24 0
+|6 8 | −|11 8 | +|11 6|
3 14 0 14 0 3
[ ]
|0 9|
3 14
+ −|
0 9|
6 8
+|
3 14|
6 8
[ 9]
11 6 8
14 = −| | +| | −|
0 14|
0 14 11 8 11 8
adj 0 3 24 9 24 9
24 0
+| 0 3| −|11 6| +|11 6|
24 0 24 0 0 3
[ ]
27 −54 60
= 336 −93 −154
−72 144 33
[ ]
1 24 8
= 24 11 2 mod 26
6 14 7
Step – 3:
The inverse matrix is:
[ ][ ]
1 24 8 5 120 40
5 24 11 2 = 120 55 10
6 14 7 30 70 35
[ ]
5 16 14
= 16 3 10 mod 26
4 18 9
Step – 4:
Converting the cipher text into column vector:
[ ] [ ][ ][ ] [ ]
X M O Q E
Z S T O K
L H H W B
Step – 5:
Decryption of first trigraph:
[ ][ ] [ ][ ]
5 16 14 X 5 16 14 23
16 3 10 Z = 16 3 10 25
4 18 9 L 4 18 9 11
[ ]
5∗23+ 16∗25+ 14∗11
= 16∗23+3∗25+10∗11
4∗23+18∗25+9∗11
[ ][ ] []
669 19 T
= 553 = 7 mod 26 = H
641 17 R
[ ][ ] [ ][ ]
5 16 14 M 5 16 14 12
16 3 10 S = 16 3 10 18
4 18 9 H 4 18 9 7
[ ]
5∗12+16∗18+14∗7
= 16∗12+ 3∗18+10∗7
4∗12+18∗18+9∗7
[ ][] []
446 4 E
= 316 = 4 mod 26 = E
435 19 T
[ ][ ] [ ][ ]
5 16 14 O 5 16 14 14
16 3 10 T = 16 3 10 19
4 18 9 H 4 18 9 7
[ ]
5∗14+ 16∗19+ 14∗7
= 16∗14 +3∗1 9+10∗7
4∗14+18∗19+9∗7
[ ][] []
472 4 E
= 351 = 13 mod 26 = N
461 19 T
[ ][ ] [ ][ ]
5 16 14 Q 5 16 14 16
16 3 10 O = 16 3 10 14
4 18 9 W 4 18 9 22
[ ]
5∗16+ 16∗14 +14∗22
= 16∗16+3∗14+10∗22
4∗16+18∗14+ 9∗22
[ ][] []
612 14 O
= 518 = 24 mod 26 = Y
514 20 U
[ ][ ] [ ][ ]
5 16 14 E 5 16 14 4
16 3 10 K = 16 3 10 10
4 18 9 B 4 18 9 1
[ ]
5∗4+16∗1 0+14∗1
= 16∗4 +3∗1 0+10∗1
4∗4 +18∗10+ 9∗1
[ ][] []
194 12 M
= 104 = 0 mod 26 = A
205 23 X
Again, (Solution converting the plain text into row wise matrix)
Solution:
Encryption:
Step - 1:
Converting the plain text into row wise matrix: We split the plaintext into 1*3 matrix
because the given key matrix is a 3*3 matrix and write these as column vectors. [T H R]
[ E E T ] [E N T ] [O Y U ] [M A X ]
Plain text into numeric row wise matrix: We must convert the plaintext row wise
matrices in the same way that we converted the keyword into the key matrix. Each letter is
replaced by its appropriate number.
[ 1 9 7 17 ] [ 4 4 19 ][ 4 13 19 ] [ 14 24 20 ] [ 12 0 23 ]
Step – 2: Now we must perform some matrix multiplication. We multiply each row wise
matrix by the key matrix in turn. We write row wise matrix first, followed by the key matrix.
Next, we have to take each of these numbers, in our resultant row wise matrix, modulo 26
(remember that means divide by 26 and take the remainder). Finally, we have to convert these
numbers back to letters to get cipher text.
[ ] [ ]
11 6 8 11 6 8
[T H R] 0 3 14 = [ 1 9 7 17 ] 0 3 14
24 0 9 24 0 9
[ ] [ ]
11 6 8 11 6 8
[E E T] 0 3 14 = [ 4 4 19 ] 0 3 14
24 0 9 24 0 9
=[ 500 36 259 ]
=[ 6 10 25 ] mod 26
= [G K Z ]
[ ] [ ]
11 6 8 11 6 8
[E N T ] 0 3 14 = [ 4 13 19 ] 0 3 14
24 0 9 24 0 9
=[ 500 63 385 ]
=[ 6 11 21 ] mod 26
= [G L V ]
[ ] [ ]
11 6 8 11 6 8
[O Y U ] 0 3 14 = [ 14 24 20 ] 0 3 14
24 0 9 24 0 9
=[ 684 72 303 ]
=[ 8 20 17 ] mod 26
= [I U R]
Decryption: To decrypt a cipher text 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 cipher text is split into, take the
results modulo the length of the alphabet, and finally convert the numbers back to letters.
In general, to find the inverse of the key matrix, we perform the calculation below, where K is
the key matrix, d is the determinant of the key matrix and adj(K) is the adjugate matrix of K.
Step – 1:
Determinant of key matrix:
| |
11 6 8
0 3 14 = 11*(3*9 – 14*0) – 6*(0*9 -14*24) + 8*(0*0 – 3*24)
24 0 9
= 1737
= 21 mod 26
Step – 2:
Finding adjugate matrix:
[ ]
+3
0 | 149 | −|240 149 | +|240 30|
[ ]
11 6 8
cofactor 0 3 14 = −
24 0 9
6
0 | 89| +|2411 89| −|1124 60|
+6
3 | 148 | −|110 148 | +|110 63|
[ ]
+3
0 | 149 | −|60 89| +|63 148 |
[ ]
11 6 8
0
adj 0 3 14 = − 24
24 0 9
| 149 | +|1124 89| −|110 148 |
+ 0
24 | 30| −|1124 60| +|110 63|
[ ]
27 −54 60
= 336 −93 −154
−72 144 33
[ ]
1 24 8
= 24 11 2 mod 26
6 14 7
Step – 3:
The inverse matrix is:
[ ][ ]
1 24 8 5 120 40
5 24 11 2 = 120 55 10
6 14 7 30 70 35
[ ]
5 16 14
= 16 3 10 mod 26
4 18 9
Step – 4:
Converting the cipher text into row wise matrix:
[ T F N ] [ G K Z ][ G L V ] [ K A E ][ I U R ]
Cipher text into numeric row wise matrix:
[ 19 5 13 ] [ 6 10 25 ][ 6 11 21 ] [ 10 0 4 ] [ 8 20 17 ]
Step – 5:
Decryption of first row wise matrix:
[ ] [ ]
5 16 14 5 16 14
[ T F N ] 16 3 10 = [ 1 9 5 13 ] 16 3 10
4 18 9 4 18 9
[ ] [ ]
5 16 14 5 16 14
[ G K Z ] 16 3 10 = [ 6 10 25 ] 16 3 10
4 18 9 4 18 9
[ ] [ ]
5 16 14 5 16 14
[ G L V ] 16 3 10 = [ 6 11 21 ] 16 3 10
4 18 9 4 18 9
[ ] [ ]
5 16 14 5 16 14
[ K A E ] 16 3 10 = [ 10 0 4 ] 16 3 10
4 18 9 4 18 9
=[ 66 232 176 ]
=[ 14 24 20 ] mod 26
= [O Y U ]
[ ] [ ]
5 16 14 5 16 14
[I U R ] 16 3 10 = [ 8 20 17 ] 16 3 10
4 18 9 4 18 9
[ ]
17 17 5
Key: 21 18 21
2 2 19
Solution:
Encryption:
Step - 1:
Converting the plain text into column vector: We split the plaintext into trigraphs
because the given key matrix is a 3*3 matrix and write these as column vectors.
[ ] [ ][ ] [ ]
P M E N
A O M E
Y R o Y
Plain text into numeric column vector(trigraph): We must convert the plaintext
column vectors in the same way that we converted the keyword into the key matrix. Each letter is
replaced by its appropriate number.
[ ] [ ] [ ][ ]
15 12 4 13
0 14 12 4
24 17 14 24
Step – 2: Now we must perform some matrix multiplication. We multiply the key matrix by
each column vector in turn. We write the key matrix first, followed by the column vector. Next,
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). Finally, we have to convert these numbers back
to letters to get cipher text.
[ ]
17∗15+17∗0+ 5∗24
= 21∗15+18∗0+21∗24
2∗15+2∗0+19∗24
[ ][] []
375 11 L
= 819 = 13 mod 26 = N
486 18 S
[ ][ ] [ ][ ]
17 17 5 M 17 17 5 12
21 18 21 O = 21 18 21 14
2 2 19 R 2 2 19 17
[ ]
17∗12+17∗14+ 5∗17
= 21∗12+18∗14+21∗17
2∗12+2∗14+19∗17
[ ][] []
527 7 H
= 816 = 3 mod 26 = D
315 11 L
[ ][ ] [ ][ ]
17 17 5 E 17 17 5 4
21 18 21 M = 21 18 21 12
2 2 19 O 2 2 19 14
[ ]
17∗4+17∗12+5∗14
= 21∗4+18∗12+21∗14
2∗4+2∗12+19∗14
[ ][] []
342 4 E
= 594 = 22 mod 26 = W
298 12 M
[ ]
17∗13+17∗4+5∗24
= 21∗13+18∗4+21∗24
2∗13+2∗4 +19∗24
[ ][] []
409 19 T
= 849 = 17 mod 26 = R
490 22 W
Decryption: To decrypt a cipher text 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 cipher text is split into, take the
results modulo the length of the alphabet, and finally convert the numbers back to letters.
In general, to find the inverse of the key matrix, we perform the calculation below, where K is
the key matrix, d is the determinant of the key matrix and adj(K) is the adjugate matrix of K.
\
Step – 1:
Determinant of key matrix:
| |
17 17 5
21 18 21 = 17*(18*19 – 21*2) – 17*(21*19 -21*2) + 5*(21*2 – 18*2)
2 2 19
f(x)
x=1 0.8461
x=2 1.7037
x=3 2.6153
x=4 3.50
x=5 4.38
x=6 5.26
x=7 6.15
x=8 7.038
x=9 7.92
x = 10 8.80
x = 11 9.62
x = 12 10.567
x = 13 11.461
x = 14 12.346
x = 15 13.23
x = 16 14.115
x = 17 15
-1
So, multiplicative inverse of determinant, d = 17
Step – 2:
Finding adjugate matrix:
[ ]
| 2 19| | 2 19| | 2 2 |
18 21
+ −
21 21
+
21 18
[ 19 ]
17 17 5
21 = −| | +| | −|
2 2|
17 5 17 5 17 17
cofactor 21 18
2 19 2 19
2 2
+|17 5 | −|17 5 | +|17 17|
18 21 21 21 21 18
[ ]
| 2 19| | 2 19| |18 21|
18 21
+ −
17 5
+
17 5
[ 19 ]
17 17 5
21 = −| | +| | −|
21 21|
21 21 17 5 17 5
adj 21 18 2 19 2 19
2 2
+|21 18| −|17 17| +|17 17|
2 2 2 2 21 18
[ ]
300 −313 267
= −357 313 −252
6 0 −51
[ ]
14 25 7
= 7 1 8 mod 26
6 0 1
Step – 3:
The inverse matrix is:
[ ][ ]
14 25 7 238 125 119
17 7 1 8 = 119 17 136
6 0 1 102 0 17
[ ]
4 9 15
= 15 17 6 mod 26
24 0 17
Step – 4:
Converting the cipher text into column vector:
[ ] [ ][ ][ ]
L H E T
N D W R
S L M W
Step – 5:
Decryption of first trigraph:
[ ][ ] [ ][ ]
4 9 15 L 4 9 15 11
15 17 6 N = 15 17 6 13
24 0 17 S 24 0 17 18
[ ]
4∗11+ 9∗13+15∗18
= 15∗11+17∗13+6∗18
24∗11+0∗13+17∗18
[ ][] []
431 15 P
= 494 = 0 mod 26 = A
570 24 Y
[ ][ ] [ ][ ]
4 9 15 H 4 9 15 7
15 17 6 D = 15 17 6 3
24 0 17 L 24 0 17 11
[ ]
4∗7+ 9∗3+ 15∗11
= 15∗7+17∗3+6∗11
24∗7+0∗3+17∗11
[ ][] []
220 12 M
= 222 = 14 mod 26 = O
355 17 R
[ ]
4∗4 +9∗22+15∗24
= 15∗4+17∗22+6∗24
24∗4 +0∗22+17∗12
[ ][] []
394 4 E
= 506 = 12 mod 26 = M
300 14 O
[ ][ ] [ ][ ]
4 9 15 T 4 9 15 19
15 17 6 R = 15 17 6 17
24 0 17 W 24 0 17 22
[ ]
4∗19+9∗17+15∗22
= 15∗19+ 17∗17 +6∗22
24∗19+0∗17+17∗22
[ ][] []
559 13 N
= 706 = 4 mod 26 = E
830 24 Y
[ ]
17 17 5
Key: 21 18 21
2 2 19
Again, (Solution converting the plain text into row wise matrix)
Solution:
Encryption:
Step - 1:
Converting the plain text into row wise matrix: We split the plaintext into 1*3 matrix
because the given key matrix is a 3*3 matrix and write these as column vectors.
[ P A Y ] [ M O R ][ E M O ] [ N E Y ]
Plain text into numeric row wise matrix: We must convert the plaintext row wise
matrices in the same way that we converted the keyword into the key matrix. Each letter is
replaced by its appropriate number.
[ 15 0 24 ] [ 12 14 17 ][ 4 12 14 ] [ 13 4 24 ]
Step – 2: Now we must perform some matrix multiplication. We multiply each row wise
matrix by the key matrix in turn. We write row wise matrix first, followed by the key matrix.
Next, we have to take each of these numbers, in our resultant row wise matrix, modulo 26
(remember that means divide by 26 and take the remainder). Finally, we have to convert these
numbers back to letters to get cipher text.
[ ] [ ]
17 17 5 17 17 5
[ P A Y ] 21 18 21 = [ 15 0 24 ] 21 18 21
2 2 19 2 2 19
[ ] [ ]
17 17 5 17 17 5
[ M O R ] 21 18 21 = [ 12 14 17 ] 21 18 21
2 2 19 2 2 19
[ ] [ ]
17 17 5 17 17 5
[ E M O ] 21 18 21 = [ 4 12 14 ] 21 18 21
2 2 19 2 2 19
[ ] [ ]
17 17 5 17 17 5
[ N E Y ] 21 18 21 = [ 13 4 24 ] 21 18 21
2 2 19 2 2 19
Decryption: To decrypt a cipher text 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 cipher text is split into, take the
results modulo the length of the alphabet, and finally convert the numbers back to letters.
In general, to find the inverse of the key matrix, we perform the calculation below, where K is
the key matrix, d is the determinant of the key matrix and adj(K) is the adjugate matrix of K.
\
Step – 1:
Determinant of key matrix:
| |
17 17 5
21 18 21 = 17*(18*19 – 21*2) – 17*(21*19 -21*2) + 5*(21*2 – 18*2)
2 2 19
f(x)
x=1 0.8461
x=2 1.7037
x=3 2.6153
x=4 3.50
x=5 4.38
x=6 5.26
x=7 6.15
x=8 7.038
x=9 7.92
x = 10 8.80
x = 11 9.62
x = 12 10.567
x = 13 11.461
x = 14 12.346
x = 15 13.23
x = 16 14.115
x = 17 15
Step – 2:
Finding adjugate matrix:
[ ]
| 2 19| | 2 19| | 2 2 |
18 21
+ −
21 21
+
21 18
[ 19 ]
17 17 5
21 = −| | +| | −|
2 2|
17 5 17 5 17 17
cofactor 21 18
2 19 2 19
2 2
+|17 5 | −|17 5 | +|17 17|
18 21 21 21 21 18
[ ]
+ 18
2 | | |
21 − 17 5
19 2 19 | +|1718 215 |
[ ]
17 17 5
21
adj 21 18 21 = − 2
2 2 19
| 21
19
+ | |
17 5
2 19 | −|1721 215 |
+ 21
2 | | |
18 − 17 17
2 2 2 | +|1721 1718|
[ ]
300 −313 267
= −357 313 −252
6 0 −51
[ ]
14 25 7
= 7 1 8 mod 26
6 0 1
Step – 3:
The inverse matrix is:
[ ][ ]
14 25 7 238 125 119
17 7 1 8 = 119 17 136
6 0 1 102 0 17
[ ]
4 9 15
= 15 17 6 mod 26
24 0 17
Step – 4:
Converting the cipher text into row wise matrix:
[ R R L] [ M W B] [ K A S ] [ P D H ]
Cipher text into numeric row wise matrix:
[ 17 17 11 ] [ 12 22 1 ][ 10 0 18 ] [ 15 3 7 ]
Step – 5:
Decryption of first row wise matrix:
[ ] [ ]
4 9 15 4 9 15
[ R R L ] 15 17 6 = [ 17 17 11 ] 15 17 6
24 0 17 24 0 17
[ ] [ ]
4 9 15 4 9 15
[ M W B ] 15 17 6 = [ 12 22 1 ] 15 17 6
24 0 17 24 0 17
[ ] [ ]
4 9 15 4 9 15
[ K A S ] 15 17 6 = [ 10 0 18 ] 15 17 6
24 0 17 24 0 17
=[ 472 90 456 ]
=[ 4 12 14 ] mod 26
= [ E M O]
[ ] [ ]
4 9 15 4 9 15
[ P D H ] 15 17 6 = [ 15 3 7 ] 15 17 6
24 0 17 24 0 17
[ ]
2 4 5
Key: 9 2 1
3 17 7
Solution:
Encryption:
Step - 1:
Converting the plain text into column vector: We split the plaintext into trigraphs
because the given key matrix is a 3*3 matrix 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.
[ ] [ ][ ][ ]
A A A A
T C T W
T K D N
Plain text into numeric column vector(trigraph): We must convert the plaintext
column vectors in the same way that we converted the keyword into the key matrix. Each letter is
replaced by its appropriate number.
[ ] [ ][ ] [ ]
0 0 0 0
19 2 19 22
19 10 3 13
Step – 2: Now we must perform some matrix multiplication. We multiply the key matrix by
each column vector in turn. We write the key matrix first, followed by the column vector. Next,
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). Finally, we have to convert these numbers back
to letters to get cipher text.
[ ][ ] [ ][ ]
2 4 5 A 2 4 5 0
9 2 1 T = 9 2 1 19
3 17 7 T 3 17 7 19
[ ]
2∗0+ 4∗19+5∗19
= 9∗0+2∗19+1∗19
3∗0+17∗19+7∗19
[ ][] []
171 15 P
= 57 = 5 mod 26 = F
456 14 O
Encryption for Second trigraph:
[ ][ ] [ ][ ]
2 4 5 A 2 4 5 0
9 2 1 C = 9 2 1 2
3 17 7 K 3 17 7 10
[ ]
2∗0+ 4∗2+5∗10
= 9∗0+2∗2+1∗10
3∗0+17∗2+ 7∗10
[ ][] []
58 6 G
= 14 = 14 mod 26 = O
104 0 A
[ ][ ] [ ][ ]
2 4 5 A 2 4 5 0
9 2 1 T = 9 2 1 19
3 17 7 D 3 17 7 3
[ ]
2∗0+ 4∗19+5∗3
= 9∗0+2∗19+1∗3
3∗0+17∗19+7∗3
[ ][] []
91 13 N
= 41 = 15 mod 26 = P
344 6 G
[ ][ ] [ ][ ]
2 4 5 A 2 4 5 0
9 2 1 W = 9 2 1 22
3 17 7 N 3 17 7 13
[ ]
2∗0+ 4∗22+5∗13
= 9∗0+2∗22+1∗13
3∗0+17∗22+ 7∗13
[ ][] []
153 23 X
= 57 = 5 mod 26 = F
465 23 X
So, the cipher text is: “PFOGOANPGXFX”
Decryption: To decrypt a cipher text 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 cipher text is split into, take the
results modulo the length of the alphabet, and finally convert the numbers back to letters.
In general, to find the inverse of the key matrix, we perform the calculation below, where K is
the key matrix, d is the determinant of the key matrix and adj(K) is the adjugate matrix of K.
Step – 1:
Determinant of key matrix:
| |
2 4 5
9 2 1 = 2*(2*7 – 1*17) – 4*(9*7 -1*3) + 5*(9*17 – 3*2)
3 17 7
= -6 – 240 + 735
= 489
= 21 mod 26
Multiplicative inverse of determinant:
d.d-1 = 1 mod 26
or, 21 x = 1 mod 26
21 x−1
So, 26
f(x)
x=1 0.7692
x=2 1.5769
x=3 2.3846
x=4 3.1923
x=5 4
So, multiplicative inverse of determinant, d-1 = 5
Step – 2:
Finding adjugate matrix:
[ ]
+ 2
17 | 17| −|93 17| +|93 172 |
[ ]
2 4 5
cofactor 9 2 1 = −
3 17 7
4
17 | 57| +|23 57| −|23 174 |
+4
2 | 51| −|29 51| +|29 42|
[ ]
| 2 1
+
17 7 | −|
4 5
17 7 | +|
2 1|
4 5
[ 7]
2 4 5
1 = −| | +|2 5| −|2 5|
9 1
adj 9 2 3 7 3 7 9 1
3 17
+|9 2 | −|2 4 | +|2 4|
3 17 3 17 9 2
[ ]
−3 57 −6
= −60 −1 43
147 −22 −32
[ ]
23 5 20
= 18 25 17 mod 26
17 4 20
Step – 3:
The inverse matrix is:
[ ][ ]
23 5 20 115 25 100
5 18 25 17 = 90 125 85
17 4 20 85 20 100
[ ]
11 25 22
= 12 21 7 mod 26
7 20 22
Step – 4:
Converting the cipher text into column vector:
[ ] [ ][ ] [ ]
P G N X
F O P F
O A G X
[ ] [ ][ ][ ]
15 6 13 23
5 14 15 5
14 0 0 23
Step – 5:
Decryption of first trigraph:
[ ][ ] [ ][ ]
11 25 22 P 11 25 22 15
12 21 7 F = 12 21 7 5
7 20 22 O 7 20 22 14
[ ]
11∗15+ 25∗5+ 22∗14
= 12∗15+21∗5+ 7∗14
7∗15+20∗5+22∗14
[ ][] []
598 0 A
= 383 = 19 mod 26 = T
513 19 T
[ ][ ] [ ][ ]
11 25 22 G 11 25 22 6
12 21 7 O = 12 21 7 14
7 20 22 A 7 20 22 0
[ ]
11∗6+25∗14+22∗0
= 12∗6+21∗14+7∗0
7∗6+ 20∗14 +22∗0
[ ][] []
368 0 A
= 366 = 2 mod 26 = C
322 10 K
[ ]
11∗13+25∗15+ 22∗6
= 12∗13+21∗15+ 7∗6
7∗13+20∗15+22∗6
[ ][] []
650 0 A
= 513 = 19 mod 26 = T
523 3 D
[ ][ ] [ ][ ]
11 25 22 X 11 25 22 23
12 21 7 F = 12 21 7 5
7 20 22 X 7 20 22 23
[ ]
11∗23+25∗5+ 22∗23
= 12∗23+21∗5+7∗23
7∗23+20∗5+22∗23
[ ][] []
884 0 A
= 542 = 22 mod 26 = W
767 13 N
[ ]
2 4 5
Key: 9 2 1
3 17 7
Again, (Solution converting the plain text into row wise matrix)
Solution:
Encryption:
Step - 1:
Converting the plain text into row wise matrix: We split the plaintext into 1*3 matrix
because the given key matrix is a 3*3 matrix and write these as column vectors. That is, in the
first row wise matrix we write the first plaintext letter at the left, and the second letter at the
right. Then we move to the next row wise matrix, where the third plaintext letter goes at the left,
and the fourth at the right. This continues for the whole plaintext.
[ A T T ] [ A C K ][ A T D ] [ A W N ]
Plain text into numeric row wise matrix: We must convert the plaintext row wise
matrices in the same way that we converted the keyword into the key matrix. Each letter is
replaced by its appropriate number.
[ 0 19 19 ] [ 0 2 10 ][ 0 19 3 ] [ 0 22 13 ]
Step – 2: Now we must perform some matrix multiplication. We multiply each row wise
matrix by the key matrix in turn. We write row wise matrix first, followed by the key matrix.
Next, we have to take each of these numbers, in our resultant row wise matrix, modulo 26
(remember that means divide by 26 and take the remainder). Finally, we have to convert these
numbers back to letters to get cipher text.
[ ] [ ]
2 4 5 2 4 5
[A T T] 9 2 1 = [ 0 19 19 ] 9 2 1
3 17 7 3 17 7
[ ] [ ]
2 4 5 2 4 5
[A C L ] 9 2 1 = [ 0 2 10 ] 9 2 1
3 17 7 3 17 7
=[ 48 174 72 ]
=[ 22 18 20 ] mod 26
= [W S U ]
[ ] [ ]
2 4 5 2 4 5
[A T D ] 9 2 1 = [ 0 19 3 ] 9 2 1
3 17 7 3 17 7
=[ 180 89 40 ]
=[ 24 11 14 ] mod 26
= [Y L O]
[ ] [ ]
2 4 5 2 4 5
[A W N] 9 2 1= [ 0 22 13 ] 9 2 1
3 17 7 3 17 7
Decryption: To decrypt a cipher text 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 cipher text is split into, take the
results modulo the length of the alphabet, and finally convert the numbers back to letters.
In general, to find the inverse of the key matrix, we perform the calculation below, where K is
the key matrix, d is the determinant of the key matrix and adj(K) is the adjugate matrix of K.
\
Step – 1:
Determinant of key matrix:
| |
2 4 5
9 2 1 = 2*(2*7 – 1*17) – 4*(9*7 -1*3) + 5*(9*17 – 3*2)
3 17 7
= -6 – 240 + 735
= 489
= 21 mod 26
Multiplicative inverse of determinant:
d.d-1 = 1 mod 26
or, 21 x = 1 mod 26
21 x−1
So, 26
f(x)
x=1 0.7692
x=2 1.5769
x=3 2.3846
x=4 3.1923
x=5 4
Step – 2:
Finding adjugate matrix:
[ ]
| 2 1
17 7 |
+ −|
9 1
3 7| +|
3 17|
9 2
[ 7]
2 4 5
1 = −| | +| | −|
3 17|
4 5 2 5 2 4
cofactor 9 2
17 7 3 7
3 17
+|4 5| −|2 5| +|2 4|
2 1 9 1 9 2
[ ]
|17 7| |17 7| |2 1|
2 1
+ −
4 5
+
4 5
[ 7]
2 4 5
1 = −| | +| | −|
9 1|
9 1 2 5 2 5
adj 9 2 3 7 3 7
3 17
+|9 2 | −|2 4 | +|2 4|
3 17 3 17 9 2
[ ]
−3 −6
57
= −60 −1 43
147 −22 −32
[ ]
23 5 20
= 18 25 17 mod 26
17 4 20
Step – 3:
The inverse matrix is:
[ ][ ]
23 5 20 115 25 100
5 18 25 17 = 90 125 85
17 4 20 85 20 100
[ ]
11 25 22
= 12 21 7 mod 26
7 20 22
Step – 4:
Converting the cipher text into row wise matrix:
[ U X W ][ W S U ][ Y L O ] [ D F J ]
Step – 5:
Decryption of first row wise matrix:
[ ] [ ]
11 25 22 11 25 22
[ U X W ] 12 21 7 = [ 20 23 22 ] 12 21 7
7 20 22 7 20 22
[ ] [ ]
11 25 22 11 25 22
[ W S U ] 12 21 7 = [ 22 18 20 ] 12 21 7
7 20 22 7 20 22
[ ] [ ]
11 25 22 11 25 22
[Y L O ] 12 21 7 = [ 24 11 14 ] 12 21 7
7 20 22 7 20 22
[ ] [ ]
11 25 22 11 25 22
[D F J ] 12 21 7 = [ 3 5 9 ] 12 21 7
7 20 22 7 20 22
Key: 24 17 [ 3 25]
(Solution converting the plain text into column vector)
Solution:
Encryption:
Step - 1:
Converting the plain text into column vector: We split the plaintext into digraphs
because the given key matrix is a 2*2 matrix 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. The plain text is shorter
here, so we have to put “X” as last letter.
[ MI ] [ SS ] [ SI ] [ SI ][ PP ] [ XI ]
Plain text into numeric column vector(trigraph): We must convert the plaintext
column vectors in the same way that we converted the keyword into the key matrix. Each letter is
replaced by its appropriate number.
=[ 424 ] =[ 8 ] mod 26 = [ I ]
236 2 C
=[ 738 ] =[ 10 ] mod 26 = [ K ]
504 10 K
=[ 498 ] =[ 4 ] mod 26 = [ E ]
474 6 G
=[ 615 ] =[ 17 ] mod 26 = [ R ]
420 4 E
Decryption: To decrypt a cipher text 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 cipher text is split into, take the
results modulo the length of the alphabet, and finally convert the numbers back to letters.
In general, to find the inverse of the key matrix, we perform the calculation below, where K is
the key matrix, d is the determinant of the key matrix and adj(K) is the adjugate matrix of K.
Step – 1:
Determinant of key matrix:
f(x)
x=1 0.8461
x=2 1.7037
x=3 2.6153
x=4 3.50
x=5 4.38
x=6 5.26
x=7 6.15
x=8 7.038
x=9 7.92
x = 10 8.80
x = 11 9.62
x = 12 10.567
x = 13 11.461
x = 14 12.346
x = 15 13.23
x = 16 14.115
x = 17 15
[a b ] [ d
adj c d = −c
−b
a ]
[ 3 25] [ 17 −253 ]
So, adj 24 17 = −24
= [ 2 3 ]mod 26
17 1
Step – 3:
The inverse matrix is:
17
[172 13] = [ 289
34 51 ]
17
= [ 8 25 ]mod 26
3 17
Step – 4:
Converting the cipher text into column vector:
[ CI ] [ KK ] [ GE ] [ WU ][ ER ] [ BL ]
Cipher text into numeric column vector(digraph):
=[ 216 ] =[ 8 ] [M]
142 12
mod 26 = I
=[ 330 ] =[ 18 ] mod 26 = [ S ]
200 18 S
=[ 148 ] =[ 18 ] [I ]
86 8
mod 26 = S
=[ 457 ] =[ 15 ] mod 26 = [ P ]
301 15 P
=[ 283 ] =[ 23 ] mod 26 = [ X ]
190 8 I
[ 3 25]
Key: 24 17
Again, (Solution converting the plain text into row wise matrix)
Solution:
Encryption:
Step - 1:
Converting the plain text into row wise matrix: We split the plaintext into 1*2 matrix
because the given key matrix is a 2*2 matrix and write these as column vectors. That is, in the
first row wise matrix we write the first plaintext letter at the left, and the second letter at the
right. Then we move to the next row wise matrix, where the third plaintext letter goes at the left,
and the fourth at the right. This continues for the whole plaintext. The plain text is shorter here,
so we have to put “X” as last letter.
[M I] [S S] [ I S] [S I ] [P P] [I X]
Plain text into numeric row wise matrix: We must convert the plaintext row wise
matrices in the same way that we converted the keyword into the key matrix. Each letter is
replaced by its appropriate number.
[ 12 8 ] [ 18 18 ] [ 8 18 ] [ 18 8 ] [ 15 15 ] [ 8 23 ]
Step – 2: Now we must perform some matrix multiplication. We multiply each row wise
matrix by the key matrix in turn. We write row wise matrix first, followed by the key matrix.
Next, we have to take each of these numbers, in our resultant row wise matrix, modulo 26
(remember that means divide by 26 and take the remainder). Finally, we have to convert these
numbers back to letters to get cipher text.
Decryption: To decrypt a cipher text 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 cipher text is split into, take the
results modulo the length of the alphabet, and finally convert the numbers back to letters.
In general, to find the inverse of the key matrix, we perform the calculation below, where K is
the key matrix, d is the determinant of the key matrix and adj(K) is the adjugate matrix of K.
Step – 1:
Determinant of key matrix:
f(x)
x=1 0.8461
x=2 1.7037
x=3 2.6153
x=4 3.50
x=5 4.38
x=6 5.26
x=7 6.15
x=8 7.038
x=9 7.92
x = 10 8.80
x = 11 9.62
x = 12 10.567
x = 13 11.461
x = 14 12.346
x = 15 13.23
x = 16 14.115
x = 17 15
Step – 2:
Finding adjugate matrix: For a 2 x 2 matrix, this is fairly straightforward as it is just
moving the elements to different positions and changing a couple of signs. That is, we swap the
top left and bottom right numbers in the key matrix, and change the sign of the top right and
bottom left numbers. Algebraically this is given below.
[a b ] [ d
adj c d = −c
−b
a ]
[ 3 25] [ 17 −253 ]
So, adj 24 17 = −24
= [ 2 3 ]mod 26
17 1
Step – 3:
The inverse matrix is:
17
[172 13] = [ 289
34 51 ]
17
= [ 8 25 ]mod 26
3 17
Step – 4:
Converting the cipher text into row wise matrix:
[U U ] [S C ] [O M ] [ M O] [ P G] [ E T]
Cipher text into numeric row wise matrix:
[ 20 20 ] [ 18 2 ] [ 14 12 ] [ 12 14 ] [ 15 6 ] [ 4 19 ]
Step – 5:
Decryption of first row wise matrix:
[ ]
[ P G ] 3 17 =[ 15 6 ] 3 17
8 25 8 25 [ ]
=[ 15∗3+ 6∗8 15∗17+6∗25 ]
=[ 93 405 ]=[ 15 15 ] mod 26 = [ P P ]