Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
7 views

Assignment Hill Cipher (1)

Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views

Assignment Hill Cipher (1)

Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 136

Comilla University

Dept. of
Computer Science and Engineering

Assignment on
Encryption and Decryption using Hill Cipher method

Course ID: CSE 4207


Course Title: Network Security

Submitted to Submitted by
Md. Mohibullah Chayti Saha
Lecturer, ID: 11608031
Dept. of CSE Session: 2015-16
Comilla University Comilla University

Date of Submission: 25 September, 2020


Do encryption and decryption of each of the following texts

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.

1. Plain text: “ACT(n=3)”


Key: ‘GYBNQKURP’
(Solution converting the plain text into column vector)
Solution:

[ ]
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.

Encryption for the trigraph:

[ ][ ] [ ][ ]
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

So, the cipher text is: “POH”

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

So, multiplicative inverse of determinant, d-1 = 25


Step – 2:
Finding adjugate matrix:

[ ]
|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

Cipher text into numeric column vector(trigraph):

[]
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

So, the plain text is: “ACT”

1. Plain text: “ACT(n=3)”


Key: ‘GYBNQKURP’
(Again, solution converting the plain text into row wise matrix)
Solution:
[ ]
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.
[ 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.

Encryption for first row wise matrix:

[ ] [ ]
6 24 1 6 24 1
[A C T ] 13 16 10 = [ 0 2 19 ] 13 16 10
20 17 15 20 17 15

=[ 0∗6+2∗13+19∗20 0∗24+ 2∗16+ 19∗17 0∗1+2∗10+19∗15 ]


=[ 406 355 305 ]
=[ 16 17 19 ] mod 26
= [Q R T ]
So, the cipher text is: “QRT”
Decryption:
Step – 2: [ Given in the column vector solution section]
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 row wise matrix:
[Q R T ]

Cipher text into numeric row wise matrix:


[ 16 17 19 ]

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

=[ 884 444 669 ]


=[ 0 2 19 ] mod 26
= [ A C T]
So, the plain text is: “ACT”
2. Plain text: “CAT(n=3)”
Key: ‘GYBNQKURP’
(Solution converting the plain text into column vector)
Solution:

[ ]
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.

Encryption for the trigraph:

[ ][ ] [ ][ ]
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

So, the cipher text is: “FIN”

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

So, multiplicative inverse of determinant, d-1 = 25

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

Cipher text into numeric column vector(trigraph):

[]
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

So, the plain text is: “CAT”

2. Plain text: “CAT(n=3)”


Key: ‘GYBNQKURP’
(Again, solution converting the plain text into row wise matrix)
Solution:

[ ]
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.

Encryption for first row wise matrix:

[ ] [ ]
6 24 1 6 24 1
[ C A T ] 13 16 10 = [ 2 0 19 ] 13 16 10
20 17 15 20 17 15

=[ 392 371 287 ]


=[ 2 7 1 ] mod 26
= [ C H B]
So, the cipher text is: “CHB”
Decryption:
Step – 2: [ Given in the column vector solution section]
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 row wise matrix:
[ C H B]

Cipher text into numeric row wise matrix:


[ 2 7 1]

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”

3. Plain text: “Short Example”


Key: “HILL”
(Solution converting the plain text into column vector)

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.

[ hs ] [ or] [ et ] [ ax] [ mp] [ el ]


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.

[ 187] [ 1417] [ 194] [ 230][ 1215] [ 114]


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.

Encryption for first digraph:

[ 117 118 ][ hs ]= [ 117 118 ][ 187]


=[ 11∗18+ 11∗7 ]
7∗18+ 8∗7

=[ 275 ] =[ 15 ] mod 26 = [ P ]
182 0 A
Encryption for Second digraph:

[ 117 118 ][ or ]= [ 117 118 ][ 1417]


=[ 11∗14+11∗17 ]
7∗14+8∗17

=[ 341 ] =[ 3 ] mod 26 = [ D ]
234 0 A

Encryption for third digraph:

[ 117 118 ][ et ]= [ 117 118 ][ 194]


[ 7∗19+ 8∗4 ]
= 11∗19+ 11∗4

=[ 253 ] =[ 19 ] mod 26 = [ T ]
165 9 J

Encryption for fourth digraph:

[ 117 118 ][ XA ]= [ 117 118 ][ 230]


[ 7∗23+8∗0 ]
= 11∗23+11∗0

=[ 253 ] =[ 19 ] mod 26 = [ T ]
161 5 F

Encryption for fifth digraph:

[ 117 118 ][ MP ]= [ 117 118 ][ 1215]


=[ 11∗12+11∗15 ]
7∗12+ 8∗15

=[ 297 ] =[ 11 ] mod 26 = [ L ]
204 22 W
Encryption for sixth digraph:

[ 117 118 ][ EL]= [ 117 118 ][ 114]


=[ 11∗11+11∗4 ]
7∗11+8∗4

=[ 165 ] =[ 9 ] mod 26 = [ J ]
109 5 F

So, the cipher text is: “APADJTFTWLFJ”

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:

|117 118 | = 7*11 – 8*11


= -11
= 15 mod 26

Multiplicative inverse of determinant:


d.d-1 = 1 mod 26
or, 15 x = 1 mod 26
15 x−1
So, 26

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

So, multiplicative inverse of determinant, d-1 = 7

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):

[ 150 ] [ 03] [ 199 ] [ 195 ][ 2211] [ 59]

Step – 5:
Decryption of first digraph:

[ 251 2223 ][ AP ]= [ 251 2223 ][ 150 ]


=[ 1∗0+ 23∗15 ]
25∗0+22∗15

=[ 345 ] =[ 7 ] mod 26 = [ h ]
330 18 s

Decryption of second digraph:

[ 251 2223 ][ DA ]= [ 251 2223 ][ 03]


=[ 1∗0+ 23∗3 ]
25∗0+22∗3

=[ 69 ] =[ 17 ] mod 26 = [ r ]
66 14 o
Decryption of third digraph:

[ 251 2223 ][ TJ ]= [ 251 2223 ][ 199 ]


=[ 1∗9+ 23∗19 ]
25∗9+22∗19

=[ 446 ] =[ 4 ] mod 26 = [ e ]
643 19 t

Decryption of fourth digraph:

[ 251 2223 ][ FT ]= [ 251 2223 ][ 195 ]


=[ 1∗5+23∗19 ]
25∗5+ 22∗19

=[ 442 ] =[ 0 ] mod 26 = [ a ]
543 23 x

Decryption of fifth digraph:

[ 251 2223 ][ WL ]= [ 251 2223 ][ 2211]


=[ 1∗22+23∗11 ]
25∗22+ 22∗11

=[ 275 ] =[ 15 ] mod 26 = [ P ]
792 12 m

Decryption of sixth digraph:

[ 251 2223 ][ FJ ]= [ 251 2223 ][ 59]


=[ 1∗5+23∗9 ]
25∗5+ 22∗9
[ ] [ ]
323
= 212
11
= 4 mod 26 = e []
l

So, the plain text is: “Short Example”.

3. Plain text: “Short Example”


Key: “HILL”
Again, (Solution converting the plain text into row wise matrix)
Solution:

[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:

[ s h] [ 117 118 ]=[ 18 7 ] [ 117 118 ]


=[ 18∗7+7∗11 18∗8+7∗11 ]
=[ 203 221 ]=[ 21 13 ] mod 26 = [ V N ]

Encryption for Second row wise matrix:

[o r] [ 117 118 ]=[ 14 17 ] [ 117 118 ]


=[ 14∗7+17∗11 14∗8+17∗11 ]
=[ 285 299 ] = [ 25 13 ] mod 26 = [ Z N ]

Encryption for third row wise matrix:

[t e] [ 117 118 ]=[ 19 4 ] [ 117 118 ]


=[ 19∗7 +4∗11 19∗8+ 4∗11]
=[ 177 196 ]=[ 21 14 ] mod 26 = [ V O ]

Encryption for fourth row wise matrix:

[ x a] [ 117 118 ]=[ 23 0] [ 117 118 ]


=[ 23∗7+0∗11 23∗8+ 0∗11]
=[ 161 184 ] = [ 5 2 ] mod 26 = [ F C ]
Encryption for fifth row wise matrix:

[ m p] [ 117 118 ]=[ 12 15 ] [ 117 118 ]


=[ 12∗7+ 15∗11 12∗8+15∗11]
=[ 249 261 ]= [ 15 1 ] mod 26 = [ P B ]
Encryption for sixth row wise matrix:

[ 11 118 ]=[ 11 4 ] [ 117 118 ]


[l e] 7

=[ 11∗7+ 4∗11 11∗8+ 4∗11 ]


=[ 121 132 ] = [ 17 2 ] mod 26 = [ R C ]

So, the cipher text is: “VNZNVOFCPBRC”

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:

|117 118 | = 7*11 – 8*11


= -11
= 15 mod 26

Multiplicative inverse of determinant:


d.d-1 = 1 mod 26
or, 15 x = 1 mod 26
15 x−1
So, 26

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

So, multiplicative inverse of determinant, d-1 = 7

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:

[V N ] [ 251 2223 ]=[ 21 13 ] [ 251 2223 ]


=[ 21∗25+ 13∗1 21∗22+13∗23 ]
=[ 538 761 ]=[ 18 7 ] mod 26 = [ s h ]

Decryption of second row wise matrix:

[Z N ] [ 251 2223 ]=[ 25 13 ] [ 251 2223 ]


=[ 25∗25+13∗1 25∗22+13∗23 ]
=[ 638 849 ] =[ 14 17 ] mod 26 = [ o r ]

Decryption of third row wise matrix:

[V O ] [ 251 2223 ]=[ 21 14 ] [ 251 2223 ]


=[ 21∗25+ 14∗1 21∗22+ 14∗23 ]
=[ 539 784 ] = [ 19 4 ] mod 26 = [ t e ]
Decryption of fourth row wise matrix:

[F C] [ 251 2223 ]=[ 5 2 ] [ 251 2223 ]


=[ 5∗25+2∗1 5∗22+2∗23 ]
=[ 127 156 ]=[ 23 0 ] mod 26 = [ x a ]

Decryption of fifth 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 ]

Decryption of sixth row wise matrix:

[R C] [ 251 2223 ]=[ 17 2] [ 251 2223 ]


=[ 17∗25+2∗1 17∗22+ 2∗23 ]
=[ 427 420 ]= [ 11 4 ] mod 26 = [ l e ]
So, the plain text is: “Short Example”.

4. Plain text: “RETREAT NOW”


Key: BACK UP (3*3)
(Solution converting the plain text into column vector)

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.

Encryption for first trigraph:

[ ][ ] [ ][ ]
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

Encryption for Second trigraph:


[ ][ ] [ ][ ]
1 0 2 R 1 0 2 17
10 20 15 E = 10 20 15 4
0 1 2 A 0 1 2 0

[ ]
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

Encryption for third trigraph:

[ ][ ] [ ][ ]
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

Encryption for fourth trigraph:

[ ][ ] [ ][ ]
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

So, the cipher text is: “DPQRQEVKPQLR”


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:

| |
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

Cipher text into numeric column vector(trigraph):

[ ] [ ][ ][ ]
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

Decryption of second trigraph:

[ ][ ] [ ][ ]
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

Decryption of third trigraph:

[ ][ ] [ ][ ]
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

Decryption of fourth trigraph:

[ ][ ] [ ][ ]
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.

Encryption for first row wise matrix:

[ ] [ ]
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]

Encryption for Second row wise matrix:

[ ] [ ]
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

=[ 149 274 261 ]


=[ 19 14 1 ] mod 26
= [ T O B]

Encryption for fourth row wise matrix:

[ ] [ ]
1 0 2 1 0 2
[W X X ] 10 20 15 = [ 22 23 23 ] 10 20 15
0 1 2 0 1 2

=[ 252 483 435 ]


=[ 18 15 19 ] mod 26
= [S P T ]
So, the cipher text is: “FVCFCQTOBSPT”
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:

| |
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:

[ ]
|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]

Decryption of second row wise matrix:

[ ] [ ]
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

=[ 199 394 329 ]


=[ 17 4 0 ] mod 26
= [R E A]

Decryption of third row wise matrix:

[ ] [ ]
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 ]

Decryption of fourth row wise matrix:

[ ] [ ]
15 22 2 15 22 2
[ S P T ] 14 22 3 = [ 18 15 19 ] 14 22 3
6 15 12 6 15 12

=[ 594 1011 309 ]


=[ 22 23 23 ] mod 26
= [W X 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”.

5. Plain text: “WE ARE SAFE”


Key: ALPHABET (3*3)
(Solution converting the plain text into column vector)

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.

Encryption for first trigraph:

[ ][ ] [ ][ ]
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

Encryption for Second trigraph:

[ ][ ] [ ][ ]
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

Encryption for third trigraph:

[ ][ ] [ ][ ]
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

So, the cipher text is: “SYICHOLER”

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

Multiplicative inverse of determinant:


d.d-1 = 1 mod 26
or, 11 x = 1 mod 26
11 x−1
So, 26

So, multiplicative inverse of determinant, d-1 = 19


Step – 2:
Finding adjugate matrix:

[ ]
+ 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

Cipher text into numeric column vector(trigraph):

[ ] [ ][ ]
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

Decryption of second trigraph:


[ ][ ] [ ][ ]
3 7 1 C 3 7 1 2
24 4 19 H = 24 4 19 7
5 4 19 O 5 4 19 14

[ ]
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

Decryption of third trigraph:

[ ][ ] [ ][ ]
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

So, the plain text is: “WE ARE SAFE”

5. Plain text: “WE ARE SAFE”


Key: ALPHABET (3*3)
Again, (Solution converting the plain text into row wise matrix)
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 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.

Encryption for first row wise matrix:

[ ] [ ]
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 ]

Encryption for Second row wise matrix:

[ ] [ ]
0 11 15 0 11 15
[R E S ] 7 0 1 = [ 17 4 18 ] 7 0 1
4 19 0 4 19 0

=[ 100 529 259 ]


=[ 22 9 25 ] mod 26
= [W J Z]

Encryption for third row wise matrix:

[ ] [ ]
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

So, multiplicative inverse of determinant, d-1 = 19


Step – 2:
Finding adjugate matrix:

[ ]
| 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

=[ 308 134 572 ]


=[ 22 4 0 ] mod 26
= [W E A]

Decryption of second row wise matrix:

[ ] [ ]
3 7 1 3 7 1
[W J Z ] 24 4 19 = [ 22 9 25 ] 24 4 19
5 4 19 5 4 19

=[ 407 290 668 ]


=[ 17 4 18 ] mod 26
= [ R E S]

Decryption of third row wise matrix:

[ ] [ ]
3 7 1 3 7 1
[Z Y F ] 24 4 19 = [ 25 24 5 ] 24 4 19
5 4 19 5 4 19

=[ 676 291 576 ]


=[ 0 5 4 ] mod 26
= [A F E]

So, the plain text is: “WE ARE SAFE”

6. Plain text: “BE HERE AT SEVEN”

[8 1]
Key: 19 14

(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.

[ 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.

[ 14 ] [ 74 ] [ 174] [ 190 ][ 184] [ 214][ 214]


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.

Encryption for first digraph:

[ 198 141 ][ BE ]= [ 198 141 ][ 14 ]


=[ 19∗1+14∗4 ]
8∗1+ 1∗4

=[ 75 ] =[ 23 ] mod 26 = [ X ]
12 12 M

Encryption for Second digraph:

[ 198 141 ][ HE ]= [ 198 141 ][ 74 ]


=[ 19∗7+ 14∗4 ]
8∗7+1∗4

=[ 18 9 ] =[ 7 ] mod 26 = [ H ]
60 8 I

Encryption for third digraph:

[ 198 141 ][ RE ]= [ 198 141 ][ 174]


=[ 19∗17+ 14∗4 ]
8∗17+1∗4

=[ 379 ] =[ 15 ] mod 26 = [ P ]
140 10 K

Encryption for fourth digraph:

[ 198 141 ][ TA ]= [ 198 141 ][ 190 ]


=[ 19∗0+ 14∗19 ]
8∗0+1∗19
[ ] [ ]
19
= 266 = 6
19
mod 26 = G []
T

Encryption for fifth digraph:

[ 198 141 ][ ES ]= [ 198 141 ][ 184]


=[ 19∗18+14∗4 ]
8∗18+1∗4

=[ 398 ] =[ 8 ] mod 26 = [ I ]
148 18 S

Encryption for sixth digraph:

[ ][ ] [
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

Encryption for seventh digraph:

[ 198 141 ][ NX ]= [ 198 141 ][ 1323]


=[ 19∗13+14∗23 ]
8∗13+1∗23

=[ 569 ] =[ 23 ] mod 26 = [ X ]
127 23 X

So, the cipher text is: “MXIHKPIGSIQNXX”

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:

|198 141 | = 8*14 – 1*19


= 93
= 15 mod 26

Multiplicative inverse of determinant:


d.d-1 = 1 mod 26
or, 15 x = 1 mod 26
15 x−1
So, 26

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

So, multiplicative inverse of determinant, d-1 = 7


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:

[ MX ] [ HI ] [ KP ] [ TG ][ SI ] [ QN ][ XX ]
Cipher text into numeric column vector(digraph):

[ 1223 ] [ 87] [ 1015] [ 196][ 188] [ 1613][ 2323]


Step – 5:
Decryption of first digraph:

[ 2023 194 ] [ MX ]= [ 2023 194 ] [ 1223]


=[ 23∗12+4∗23 ]
20∗12+19∗23

=[ 368 ] =[ 4 ] mod 26 = [ E ]
677 1 B

Decryption of second digraph:

[ 2023 194 ] [ HI ]= [ 2023 194 ] [ 87]


=[ 23∗8+ 4∗7 ]
20∗8+19∗7

=[ 212 ] =[ 4 ] mod 26 = [ E ]
293 7 H

Decryption of third digraph:

[ 243 2517][ KP ]= [ 243 2517][ 1015]


=[ 23∗10+ 4∗15 ]
20∗10+ 19∗15

=[ 290 ] =[ 4 ] mod 26 = [ E ]
485 17 R

Decryption of fourth digraph:

[ 38 1725 ][ GT ]= [ 38 1725 ][ 196]


[ 20∗19+ 19∗6 ]
= 23∗19+ 4∗6
[ ] [ ]
494
= 461
0
= 19 []
A
mod 26 = T

Decryption of fifth digraph:

[ 38 1725 ][ SI ]= [ 38 1725 ][ 188]


=[ 23∗18+ 4∗8 ]
20∗18+ 19∗8

=[ 446 ] =[ 4 ] mod 26 = [ E ]
512 18 S

Decryption of sixth digraph:

[ 38 1725 ][ QN ]= [ 38 1725 ][ 1136]


=[ 23∗1 6+4∗19 ]
20∗1 6+19∗13

=[ 420 ] =[ 4 ] mod 26 = [ E ]
567 21 V

Decryption of seventh digraph:

[ 38 1725 ][ XX ]= [ 38 1725 ][ 2323]


=[ 23∗23+ 4∗23 ]
20∗23+ 19∗23

=[ 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”.

6. Plain text: “BE HERE AT SEVEN”


[
Key: 19 14
8 1
]
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.
[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.

Encryption for first row wise matrix:

[B E] [ 198 141 ]=[ 1 4 ] [ 198 141 ]


=[ 1∗8+ 4∗19 1∗1+ 4∗14 ]
=[ 84 57 ]=[ 6 5 ] mod 26 = [ G F ]

Encryption for Second row wise matrix:


[H E] [ 8 1
19 14 ]
=[7 4]
8 1
19 14 [ ]
=[ 7∗8+ 4∗19 7∗1+4∗14 ]
=[ 132 63 ] = [ 2 11 ] mod 26 = [ C L ]

Encryption for third row wise matrix:

[R E] [ 198 141 ]=[ 17 4 ] [ 198 141 ]


=[ 17∗8+4∗19 17∗1+4∗14 ]
=[ 212 73 ]=[ 4 2 1 ] mod 26 = [ E V ]

Encryption for fourth row wise matrix:

[ A T] [ 198 141 ]=[ 0 19 ] [ 198 141 ]


=[ 0∗8+19∗19 0∗1+19∗14 ]
=[ 361 266 ] = [ 23 6 ] mod 26 = [ X G ]
Encryption for fifth row wise matrix:

[S E] [ 198 141 ]=[ 18 4 ] [ 198 141 ]


=[ 18∗8+4∗19 18∗1+ 4∗14 ]
=[ 220 74 ] = [ 12 22 ] mod 26 = [ M W ]

Encryption for sixth row wise matrix:

[V E] [ 198 141 ]=[ 21 4 ] [ 198 141 ]


=[ 21∗8+ 4∗19 21∗1+ 4∗14 ]
=[ 244 77 ] = [ 10 25 ] mod 26 = [ K Z ]
Encryption for seventh row wise matrix:

[N X] [ 198 141 ]=[ 13 23 ] [ 198 141 ]


=[ 13∗8+23∗19 13∗1+23∗14 ]
=[ 541 335 ] = [ 21 23 ] mod 26 = [ Y X ]

So, the cipher text is: “GFCLEVXGMWKZYX”

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:

|198 141 | = 8*14 – 1*19


= 93
= 15 mod 26

Multiplicative inverse of determinant:


d.d-1 = 1 mod 26
or, 15 x = 1 mod 26
15 x−1
So, 26

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

So, multiplicative inverse of determinant, d-1 = 7

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:

[G F] [ 2023 194 ]=[ 6 5] [ 2023 194 ]


=[ 6∗20+5∗23 6∗19+5∗4 ]
=[ 235 134 ] =[ 1 4 ] mod 26 = [ B E ]

Decryption of second row wise matrix:

[ C L] [ 2023 194 ]=[ 2 11 ] [ 2023 194 ]


=[ 2∗20+ 11∗23 2∗19+11∗4 ]
=[ 293 82 ]=[ 7 4 ] mod 26 = [ H E ]

Decryption of third row wise matrix:

[E V ] [ 2023 194 ]=[ 4 2 1] [ 2023 194 ]


=[ 4∗20+ 21∗23 4∗19+21∗4 ]
=[ 563 160 ] = [ 17 4 ] mod 26 = [ R E ]
Decryption of fourth row wise matrix:

[ X G] [ 2023 194 ]=[ 23 6] [ 2023 194 ]


=[ 23∗20+6∗23 21∗19+6∗4 ]
=[ 598 461 ]=[ 0 19 ] mod 26 = [ A T ]

Decryption of fifth 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 ]

Decryption of sixth row wise matrix:

[ K Z] [ 2023 194 ]=[ 10 25 ] [ 2023 194 ]


=[ 10∗20+25∗23 10∗19+25∗4 ]
=[ 775 290 ]= [ 21 4 ] mod 26 = [ V E ]

Decryption of seventh row wise matrix:

[Y X] [ 2023 194 ]=[ 21 23 ] [ 2023 194 ]


=[ 21∗20+ 23∗23 21∗19+23∗4 ]
=[ 949 491 ] = [ 13 23 ] mod 26 = [ N X ]

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.

[ 228 ] [ 118 ] [ 111] [ 114 ][ 190 ] [ 234 ]


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.

Encryption for first digraph:


[ 198 141 ][ WI ]= [ 198 141 ][ 228 ]
=[ 19∗8+ 14∗22 ]
8∗8+1∗22

=[ 460 ] =[ 18 ] mod 26 = [ S ]
86 8 I

Encryption for Second digraph:

[ 198 141 ][ LI ]= [ 198 141 ][ 118 ]


=[ 19∗8+ 14∗11]
8∗8+1∗11

=[ 306 ] =[ 20 ] mod 26 = [ U ]
75 23 X

Encryption for third digraph:

[ 198 141 ][ BL ]= [ 198 141 ][ 111]


=[ 19∗11+ 14∗1 ]
8∗11+1∗1

=[ 223 ] =[ 15 ] mod 26 = [ P ]
89 11 L

Encryption for fourth digraph:

[ 198 141 ][ EL]= [ 198 141 ][ 114 ]


=[ 19∗4+14∗11 ]
8∗4 +1∗11

=[ 230 ] =[ 22 ] mod 26 = [ W ]
43 17 R

Encryption for fifth digraph:


[ ][ ] [
8 1 A
19 14 T
=
8 1 0
19 14 19 ][ ]
=[ 19∗0+ 14∗19 ]
8∗0+1∗19

=[ 266 ] =[ 6 ] mod 26 = [ G ]
19 19 T

Encryption for sixth digraph:

[ 198 141 ][ EX ]= [ 198 141 ][ 234 ]


=[ 19∗4+14∗23 ]
8∗4 +1∗23

=[ 398 ] =[ 8 ] mod 26 = [ I ]
55 3 D

So, the cipher text is: “ISXULPRWTGDI”

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:

|198 141 | = 8*14 – 1*19


= 93
= 15 mod 26
Multiplicative inverse of determinant:
d.d-1 = 1 mod 26
or, 15 x = 1 mod 26
15 x−1
So, 26

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

So, multiplicative inverse of determinant, d-1 = 7

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):

[ 188 ] [ 2320 ] [ 1115] [ 1722][ 196] [ 38]


Step – 5:
Decryption of first digraph:

[ 2023 194 ] [ SI ]= [ 2023 194 ] [ 188 ]


=[ 23∗8+ 4∗8 ]
20∗8+19∗18

=[ 256 ] =[ 22 ] mod 26 = [ W ]
502 8 I

Decryption of second digraph:

[ 2023 194 ] [ UX ]= [ 2023 194 ] [ 2320]


[20∗23+ 19∗20
= 23∗23+ 4∗20 ]
=[ 609 ] =[ 11] mod 26 = [ L ]
840 8 I

Decryption of third digraph:

[ 243 2517][ PL]= [ 243 2517][ 1115]


=[ 23∗11+ 4∗15 ]
20∗11+19∗15

=[ 313 ] =[ 1 ] mod 26 = [ B ]
505 11 L

Decryption of fourth digraph:

[ 38 1725 ][ WR ]= [ 38 1725 ][ 1722]


[ 20∗17 +19∗22]
= 23∗17+ 4∗22

=[ 479 ] =[ 11] mod 26 = [ L ]


758 4 E

Decryption of fifth digraph:

[ ][ ] [
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

Decryption of sixth digraph:

[ 38 1725 ][ DI ]= [ 38 1725 ][ 38]


[ 20∗3+ 19∗8
= 23∗3+ 4∗8 ]
=[ 101 ] =[ 23 ] mod 26 = [ X ]
212 4 E

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”.

7. Plain text: “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.

Encryption for first row wise matrix:

[I W ] [ 198 141 ]=[ 8 22 ] [ 198 141 ]


=[ 8∗8+22∗19 8∗1+22∗14 ]
=[ 482 316 ] =[ 14 4 ] mod 26 = [ O E ]

Encryption for Second row wise matrix:

[ I L] [ 198 141 ]=[ 8 11] [ 198 141 ]


=[ 8∗8+11∗19 8∗1+11∗14 ]
=[ 273 162 ] = [ 13 6 ] mod 26 = [ N G ]

Encryption for third row wise matrix:

[ L B] [ 198 141 ]=[ 11 1] [ 198 141 ]


=[ 11∗8+1∗19 11∗1+1∗14 ]
=[ 107 25 ]=[ 3 25 ] mod 26 = [ D Z ]

Encryption for fourth row wise matrix:

[ E L] [ 198 141 ]=[ 4 11 ] [ 198 141 ]


=[ 4∗8+11∗19 4∗1+ 11∗14 ]
=[ 241 158 ] = [ 7 2 ] mod 26 = [ H C ]
Encryption for fifth row wise matrix:
[ A T] [ 8 1
19 14]=[ 0 19 ]
8 1
19 14[ ]
=[ 0∗8+19∗19 0∗1+19∗14 ]
=[ 361 266 ]= [ 23 6 ] mod 26 = [ X G ]

Encryption for sixth row wise matrix:

[E X] [ 198 141 ]=[ 4 23 ] [ 198 141 ]


=[ 4∗8+23∗19 4∗1+ 23∗14 ]
=[ 469 326 ] = [ 1 14 ] mod 26 = [ B O ]

So, the cipher text is: “OENGDZHCXGBO”

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:

|198 141 | = 8*14 – 1*19


= 93
= 15 mod 26
Multiplicative inverse of determinant:
d.d-1 = 1 mod 26
or, 15 x = 1 mod 26
15 x−1
So, 26

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

So, multiplicative inverse of determinant, d-1 = 7

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:

[O E] [ 2023 194 ]=[ 14 4 ] [ 2023 194 ]


=[ 14∗20+ 4∗23 14∗19+ 4∗4 ]
=[ 372 282 ]=[ 8 22 ] mod 26 = [ I W ]

Decryption of second row wise matrix:

[N G] [ 2023 194 ]=[ 13 6] [ 2023 194 ]


=[ 13∗20+6∗23 13∗19+6∗4 ]
=[ 398 272 ]=[ 8 11] mod 26 = [ I L ]

Decryption of third row wise matrix:


[ D Z] [ 20 19
23 4 ]
=[ 3 25 ] [
20 19
23 4 ]
=[ 3∗20+25∗23 3∗19+25∗4 ]
=[ 635 157 ] = [ 11 1 ] mod 26 = [ L B ]

Decryption of fourth row wise matrix:

[H C] [ 2023 194 ]=[ 7 2] [ 2023 194 ]


=[ 7∗20+2∗23 7∗19+2∗4 ]
=[ 186 141 ]=[ 4 11 ] mod 26 = [ E L ]

Decryption of fifth 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 ]

Decryption of sixth row wise matrix:

[B O] [ 2023 194 ]=[ 1 14 ] [ 2023 194 ]


=[ 1∗20+ 14∗23 1∗19+14∗4 ]
=[ 342 75 ]= [ 4 23 ] mod 26 = [ E X ]

So, the plain text is: “I WILL BE LATE”.

8. Plain text: “BE ON TIME AT TEN”


[ ]
11 6 8
Key: 0 3 14
24 0 9

(Solution converting the plain text into column vector)

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.

Encryption for first trigraph:

[ ][ ] [ ][ ]
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

Encryption for Second trigraph:

[ ][ ] [ ][ ]
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

Encryption for third trigraph:

[ ][ ] [ ][ ]
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

Encryption for fourth trigraph:

[ ][ ] [ ][ ]
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

Encryption for fifth trigraph:

[ ][ ] [ ][ ]
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

So, the cipher text is: “RAUJNUAMCRJYXBZ”

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

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:

[ ]
|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

Cipher text into numeric column vector(trigraph):


[ ] [ ][ ][ ] [ ]
1 13 12 19 13
4 19 4 19 23
14 8 0 4 23

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

Decryption of second trigraph:

[ ][ ] [ ][ ]
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

Decryption of third trigraph:

[ ][ ] [ ][ ]
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

Decryption of fourth trigraph:

[ ][ ] [ ][ ]
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

Decryption of fifth trigraph:

[ ][ ] [ ][ ]
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

So, the plain text is: “BE ON TIME AT TEN”

8. Plain text: “BE ON TIME AT TEN”


[ ]
11 6 8
Key: 0 3 14
24 0 9

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.

Encryption for first row wise matrix:

[ ] [ ]
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

=[ 335 135 442 ]


=[ 23 5 0 ] mod 26
= [X F A]

Encryption for third row wise matrix:

[ ] [ ]
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 ]

Encryption for fourth row wise matrix:

[ ] [ ]
11 6 8 11 6 8
[T T E ] 0 3 14 = [ 19 19 4 ] 0 3 14
24 0 9 24 0 9

=[ 305 171 454 ]


=[ 19 15 12 ] mod 26
= [T P M ]

Encryption for fifth row wise matrix:


[ ] [ ]
11 6 8 11 6 8
[ N X X ] 0 3 14 = [ 13 23 23 ] 0 3 14
24 0 9 24 0 9

=[ 695 147 633 ]


=[ 19 17 9 ] mod 26
= [T R J ]

So, the cipher text is: “JSIXFACGWTPMTRJ”

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

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:

[ ]
+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

=[ 365 342 378 ]


=[ 1 4 1 4 ] mod 26
= [B E O]

Decryption of second row wise matrix:

[ ] [ ]
5 16 14 5 16 14
[ X F A ] 16 3 10 = [ 23 5 0 ] 16 3 10
4 18 9 4 18 9

=[ 195 383 372 ]


=[ 13 19 8 ] mod 26
= [N T I]

Decryption of third row wise matrix:

[ ] [ ]
5 16 14 5 16 14
[ C G W ] 16 3 10 = [ 2 6 22 ] 16 3 10
4 18 9 4 18 9

=[ 194 446 286 ]


=[ 12 4 0 ] mod 26
= [M E A]

Decryption of fourth row wise matrix:

[ ] [ ]
5 16 14 5 16 14
[ T P M ] 16 3 10 = [ 19 15 12 ] 16 3 10
4 18 9 4 18 9

=[ 383 565 524 ]


=[ 19 19 4 ] mod 26
= [T T E]

Decryption of fifth row wise matrix:

[ ] [ ]
5 16 14 5 16 14
[T R J ] 16 3 10 = [ 19 17 9 ] 16 3 10
4 18 9 4 18 9

=[ 403 517 517 ]


=[ 13 23 23 ] mod 26
= [N X X]

So, the plain text is: “BE ON TIME AT TEN”


9. Plain text: “THREE TEN TO YUMA”

[ ]
11 6 8
Key: 0 3 14
24 0 9

(Solution converting the plain text into column vector)

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.

Encryption for first trigraph:


[ ][ ] [ ][ ]
11 6 8 T 11 6 8 1 9
6 3 14 H = 6 3 14 7
24 0 9 R 24 0 9 1 7

[ ]
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

Encryption for Second trigraph:

[ ][ ] [ ][ ]
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

Encryption for third trigraph:

[ ][ ] [ ][ ]
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

Encryption for fourth trigraph:


[ ][ ] [ ][ ]
11 6 8 O 11 6 8 14
0 3 14 Y = 0 3 14 24
24 0 9 U 24 0 9 20

[ ]
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

Encryption for fifth trigraph:

[ ][ ] [ ][ ]
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

So, the cipher text is: “XZLMSHOTHQOWEKB”

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

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:

[ ]
|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

Cipher text into numeric column vector(trigraph):


[ ] [ ][ ] [ ] [ ]
23 12 14 16 4
25 18 19 14 10
11 7 7 22 1

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

Decryption of second trigraph:

[ ][ ] [ ][ ]
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

Decryption of third trigraph:

[ ][ ] [ ][ ]
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

Decryption of fourth trigraph:

[ ][ ] [ ][ ]
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

Decryption of fifth trigraph:

[ ][ ] [ ][ ]
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

So, the plain text is: “THREE TEN TO YUMA”

9. Plain text: “THREE TEN TO YUMA”


[ ]
11 6 8
Key: 0 3 14
24 0 9

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.

Encryption for first row wise matrix:

[ ] [ ]
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

=[ 617 135 403 ]


=[ 1 9 5 13 ] mod 26
= [T F N ]
Encryption for Second row wise matrix:

[ ] [ ]
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 ]

Encryption for third row wise matrix:

[ ] [ ]
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 ]

Encryption for fourth row wise matrix:

[ ] [ ]
11 6 8 11 6 8
[O Y U ] 0 3 14 = [ 14 24 20 ] 0 3 14
24 0 9 24 0 9

=[ 634 156 628 ]


=[ 10 0 4 ] mod 26
= [K A E]

Encryption for fifth row wise matrix:


[ ] [ ]
11 6 8 11 6 8
[M A X] 0 3 14 = [ 12 0 23 ] 0 3 14
24 0 9 24 0 9

=[ 684 72 303 ]
=[ 8 20 17 ] mod 26
= [I U R]

So, the cipher text is: “TFNGKZGLVKAEIUR”

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

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:

[ ]
+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

=[ 227 553 433 ]


=[ 1 9 7 17 ] mod 26
= [T H R]

Decryption of second row wise matrix:

[ ] [ ]
5 16 14 5 16 14
[ G K Z ] 16 3 10 = [ 6 10 25 ] 16 3 10
4 18 9 4 18 9

=[ 290 576 409 ]


=[ 4 4 19 ] mod 26
= [E E T]

Decryption of third row wise matrix:

[ ] [ ]
5 16 14 5 16 14
[ G L V ] 16 3 10 = [ 6 11 21 ] 16 3 10
4 18 9 4 18 9

=[ 290 507 383 ]


=[ 4 13 19 ] mod 26
= [E N T]

Decryption of fourth row wise matrix:

[ ] [ ]
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 ]

Decryption of fifth row wise matrix:

[ ] [ ]
5 16 14 5 16 14
[I U R ] 16 3 10 = [ 8 20 17 ] 16 3 10
4 18 9 4 18 9

=[ 428 494 465 ]


=[ 12 0 23 ] mod 26
= [M A X]

So, the plain text is: “THREE TEN TO YUMA”


10. Plain text: “PAY MORE MONEY”

[ ]
17 17 5
Key: 21 18 21
2 2 19

(Solution converting the plain text into column vector)

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.

Encryption for first trigraph:


[ ][ ] [ ][ ]
17 17 5 P 17 17 5 15
21 18 21 A = 21 18 21 0
2 2 19 Y 2 2 19 24

[ ]
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

Encryption for Second trigraph:

[ ][ ] [ ][ ]
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

Encryption for third trigraph:

[ ][ ] [ ][ ]
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

Encryption for fourth trigraph:


[ ][ ] [ ][ ]
17 17 5 N 17 17 5 13
21 18 21 E = 21 18 21 4
2 2 19 Y 2 2 19 24

[ ]
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

So, the cipher text is: “LNSHDLEWMTRW”

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

= 17*300 – 17*357 + 5*6


= -939
= 23 mod 26

Multiplicative inverse of determinant:


d.d-1 = 1 mod 26
or, 23 x = 1 mod 26
23 x −1
So, 26

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

Cipher text into numeric column vector(trigraph):


[ ] [ ][ ] [ ]
11 7 4 19
13 3 22 17
18 11 12 22

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

Decryption of second trigraph:

[ ][ ] [ ][ ]
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

Decryption of third trigraph:


[ ][ ] [ ][ ]
4 9 15 E 4 9 15 4
15 17 6 W = 15 17 6 22
24 0 17 M 24 0 17 12

[ ]
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

Decryption of fourth trigraph:

[ ][ ] [ ][ ]
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

So, the plain text is: “PAY MORE MONEY”

10. Plain text: “PAY MORE MONEY”

[ ]
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.

Encryption for first row wise matrix:

[ ] [ ]
17 17 5 17 17 5
[ P A Y ] 21 18 21 = [ 15 0 24 ] 21 18 21
2 2 19 2 2 19

=[ 255+0+ 48 255+0+ 48 75+ 0+456 ]


=[ 303 303 531 ]
=[ 17 17 11 ] mod 26
= [ R R L]

Encryption for Second row wise matrix:

[ ] [ ]
17 17 5 17 17 5
[ M O R ] 21 18 21 = [ 12 14 17 ] 21 18 21
2 2 19 2 2 19

=[ 204+ 294+34 204 +252+34 60+294+ 323 ]


=[ 532 490 677 ]
=[ 12 22 1 ] mod 26
= [M W B]

Encryption for third row wise matrix:

[ ] [ ]
17 17 5 17 17 5
[ E M O ] 21 18 21 = [ 4 12 14 ] 21 18 21
2 2 19 2 2 19

=[ 68+252+28 68+216+28 20+252+266 ]


=[ 348 312 538 ]
=[ 10 0 18 ] mod 26
= [ K A S]

Encryption for fourth row wise matrix:

[ ] [ ]
17 17 5 17 17 5
[ N E Y ] 21 18 21 = [ 13 4 24 ] 21 18 21
2 2 19 2 2 19

=[ 221+84+ 48 221+72+ 48 65+84 +456 ]


=[ 353 341 605 ]
=[ 15 3 7 ] mod 26
= [P D H]
So, the cipher text is: “RRLMWBKASPDH”

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

= 17*300 – 17*357 + 5*6


= -939
= 23 mod 26

Multiplicative inverse of determinant:


d.d-1 = 1 mod 26
or, 23 x = 1 mod 26
23 x −1
So, 26

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

So, multiplicative inverse of determinant, d-1 = 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

[ ]
+ 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

=[ 587 442 544 ]


=[ 15 0 24 ] mod 26
= [P A Y]

Decryption of second row wise matrix:

[ ] [ ]
4 9 15 4 9 15
[ M W B ] 15 17 6 = [ 12 22 1 ] 15 17 6
24 0 17 24 0 17

=[ 402 482 329 ]


=[ 12 14 17 ] mod 26
= [M O R]

Decryption of third row wise matrix:

[ ] [ ]
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]

Decryption of fourth row wise matrix:

[ ] [ ]
4 9 15 4 9 15
[ P D H ] 15 17 6 = [ 15 3 7 ] 15 17 6
24 0 17 24 0 17

=[ 272 186 362 ]


=[ 13 4 24 ] mod 26
= [N E Y]

So, the plain text is: “PAY MORE MONEY”

11. Plain text: “Attack AT DAWN”

[ ]
2 4 5
Key: 9 2 1
3 17 7

(Solution converting the plain text into column vector)

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.

Encryption for first trigraph:

[ ][ ] [ ][ ]
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

Encryption for third trigraph:

[ ][ ] [ ][ ]
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

Encryption for fourth trigraph:

[ ][ ] [ ][ ]
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

Cipher text into numeric column vector(trigraph):

[ ] [ ][ ][ ]
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

Decryption of second trigraph:

[ ][ ] [ ][ ]
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

Decryption of third trigraph:


[ ][ ] [ ][ ]
11 25 22 N 11 25 22 13
12 21 7 P = 12 21 7 15
7 20 22 G 7 20 22 6

[ ]
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

Decryption of fourth trigraph:

[ ][ ] [ ][ ]
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

So, the plain text is: “ATTACK AT DAWN”

11. Plain text: “Attack AT DAWN”

[ ]
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.

Encryption for first row wise matrix:

[ ] [ ]
2 4 5 2 4 5
[A T T] 9 2 1 = [ 0 19 19 ] 9 2 1
3 17 7 3 17 7

=[ 228 361 152 ]


=[ 20 23 22 ] mod 26
= [U X W ]

Encryption for Second row wise matrix:

[ ] [ ]
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 ]

Encryption for third row wise matrix:

[ ] [ ]
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]

Encryption for fourth row wise matrix:

[ ] [ ]
2 4 5 2 4 5
[A W N] 9 2 1= [ 0 22 13 ] 9 2 1
3 17 7 3 17 7

=[ 237 265 113 ]


=[ 3 5 9 ] mod 26
= [D F J]
So, the cipher text is: “UXWWSUYLODFJ”

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 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 ]

Cipher text into numeric row wise matrix:


[ 20 23 22 ] [ 22 18 20 ] [ 24 11 14 ] [ 3 5 9 ]

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

=[ 650 1423 1085 ]


=[ 0 19 19 ] mod 26
= [A T T]

Decryption of second row wise matrix:

[ ] [ ]
11 25 22 11 25 22
[ W S U ] 12 21 7 = [ 22 18 20 ] 12 21 7
7 20 22 7 20 22

=[ 598 1328 1050 ]


=[ 0 2 10 ] mod 26
= [A C K]

Decryption of third row wise matrix:

[ ] [ ]
11 25 22 11 25 22
[Y L O ] 12 21 7 = [ 24 11 14 ] 12 21 7
7 20 22 7 20 22

=[ 494 1111 913 ]


=[ 0 19 3 ] mod 26
= [A T D]

Decryption of fourth row wise matrix:

[ ] [ ]
11 25 22 11 25 22
[D F J ] 12 21 7 = [ 3 5 9 ] 12 21 7
7 20 22 7 20 22

=[ 156 360 299 ]


=[ 0 22 13 ] mod 26
= [A W N]

So, the plain text is: “ATTACK AT DAWN”

12. Plain text: “MISSISSIPPI”

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.

[ 128] [ 1818] [ 188 ] [ 188][ 1515] [ 238 ]


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.

Encryption for first digraph:

[ 243 2517][ MI ]= [ 243 2517][ 128]


=[ 24∗12+17∗8 ]
3∗12+ 25∗8

=[ 424 ] =[ 8 ] mod 26 = [ I ]
236 2 C

Encryption for Second digraph:

[ 243 2517][ SS]= [ 243 2517][ 1818]


=[ 24∗18+17∗18 ]
3∗18+25∗18

=[ 738 ] =[ 10 ] mod 26 = [ K ]
504 10 K

Encryption for third digraph:

[ 243 2517][ SI ]= [ 243 2517][ 188 ]


=[ 24∗8+17∗18 ]
3∗8+25∗18

=[ 498 ] =[ 4 ] mod 26 = [ E ]
474 6 G

Encryption for fourth digraph:

[ 243 2517][ SI]= [ 243 2517][ 188]


[ 3∗18+25∗8
= 24∗18+17∗18 ]
=[ 568 ] =[ 22 ] mod 26 = [ W ]
254 20 U

Encryption for fifth digraph:

[ 243 2517][ PP ]= [ 243 2517][ 1515]


=[ 24∗15+17∗15 ]
3∗15+25∗15

=[ 615 ] =[ 17 ] mod 26 = [ R ]
420 4 E

Encryption for sixth digraph:

[ 243 2517][ XI ]= [ 243 2517][ 238 ]


=[ 24∗8+17∗23 ]
3∗8+25∗23

=[ 583 ] =[ 11] mod 26 = [ L ]


599 1 B

So, the cipher text is: “CIKKGEUWERBL”

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:

|243 2517| = 3*17 – 25*24


= -549
= 23 mod 26

Multiplicative inverse of determinant:


d.d-1 = 1 mod 26
or, 23 x = 1 mod 26
23 x −1
So, 26

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

So, multiplicative inverse of determinant, d-1 = 17


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 column vector:

[ CI ] [ KK ] [ GE ] [ WU ][ ER ] [ BL ]
Cipher text into numeric column vector(digraph):

[ 28] [ 1010] [ 64 ] [ 2022][ 174 ] [ 111 ]


Step – 5:
Decryption of first digraph:

[ 38 1725 ][ CI ]= [ 38 1725 ][ 28]


[ 3∗2+17∗8 ]
= 8∗2+ 25∗8

=[ 216 ] =[ 8 ] [M]
142 12
mod 26 = I

Decryption of second digraph:

[ 38 1725 ][ KK ]= [ 38 1725 ][ 1010]


[ 3∗10+ 17∗10 ]
= 8∗10+ 25∗10

=[ 330 ] =[ 18 ] mod 26 = [ S ]
200 18 S

Decryption of third digraph:

[ 243 2517][ GE ]= [ 243 2517][ 64]


=[ 8∗6+25∗4 ]
3∗6 +17∗4

=[ 148 ] =[ 18 ] [I ]
86 8
mod 26 = S

Decryption of fourth digraph:

[ 38 1725 ][ WU ]= [ 38 1725 ][ 2022]


[3∗20+ 17∗22
= 8∗20+25∗22 ]
=[ 710 ] =[ 8 ] mod 26 = [ I ]
434 18 S

Decryption of fifth digraph:

[ 38 1725 ][ ER ]= [ 38 1725 ][ 174 ]


=[ 8∗4+ 25∗17 ]
3∗4+17∗17

=[ 457 ] =[ 15 ] mod 26 = [ P ]
301 15 P

Decryption of sixth digraph:

[ 38 1725 ][ BL ]= [ 38 1725 ][ 111 ]


=[ 8∗1+ 25∗11 ]
3∗1+17∗11

=[ 283 ] =[ 23 ] mod 26 = [ X ]
190 8 I

So, the plain text is: “MISSISSIPPIX”. Here last letter X is


dummy, So the final plain text is: “MISSISSIPPI”.

12. Plain text: “MISSISSIPPI”

[ 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.

Encryption for first row wise matrix:

[M I] [ 243 2517]=[ 12 8 ] [ 243 2517]


=[ 12∗3+ 8∗24 12∗25+8∗17 ]
=[ 228 436 ]=[ 20 20 ] mod 26 = [ U U ]

Encryption for Second row wise matrix:

[S S] [ 243 2517]=[ 18 18 ] [ 243 2517]


=[ 18∗3+ 18∗24 18∗25+18∗17 ]
=[ 486 756 ] = [ 18 2 ] mod 26 = [ S C ]
Encryption for third row wise matrix:

[ I S] [ 243 2517]=[ 8 18 ] [ 243 2517]


=[ 8∗3+18∗24 8∗25+ 18∗17 ]
=[ 456 506 ]=[ 14 12 ] mod 26 = [ O M ]

Encryption for fourth row wise matrix:

[S I ] [ 243 2517]=[ 18 8] [ 243 2517]


=[ 18∗3+8∗24 18∗25+ 18∗17 ]
=[ 246 586 ] = [ 12 14 ] mod 26 = [ M O ]
Encryption for fifth row wise matrix:

[P P] [ 243 2517]=[ 15 15 ] [ 243 2517]


=[ 15∗3+ 15∗24 15∗25+15∗17 ]
=[ 405 630 ]= [ 15 6 ] mod 26 = [ P G ]

Encryption for sixth row wise matrix:

[I X] [ 243 2517]=[ 8 23 ] [ 243 2517]


=[ 8∗3+23∗24 8∗25+23∗17 ]
=[ 576 591 ] = [ 4 19 ] mod 26 = [ E T ]

So, the cipher text is: “UUSCOMMOPGET”

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:

|243 2517| = 3*17 – 25*24


= -549
= 23 mod 26
Multiplicative inverse of determinant:
d.d-1 = 1 mod 26
or, 23 x = 1 mod 26
23 x −1
So, 26

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

So, multiplicative inverse of determinant, d-1 = 17

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:

[U U ] [ 38 1725 ]=[ 20 20 ] [ 38 1725 ]


=[ 20∗3+20∗8 20∗17+20∗25 ]
=[ 220 840 ]=[ 12 8 ] mod 26 = [ M I ]

Decryption of second row wise matrix:

[S C ] [ 38 1725 ]=[ 18 2 ] [ 38 1725 ]


=[ 18∗3+ 2∗8 18∗17+2∗25 ]
=[ 70 356 ]=[ 18 18 ] mod 26 = [ S S ]

Decryption of third row wise matrix:

[O M ] [ 38 1725 ]=[ 14 12 ] [ 38 1725 ]


=[ 14∗3+12∗8 14∗17 +12∗25 ]
=[ 138 538 ] = [ 8 18 ] mod 26 = [ I S ]

Decryption of fourth row wise matrix:

[ M O] [ 38 1725 ]=[ 12 14 ] [ 38 1725 ]


=[ 12∗3+14∗8 12∗17+14∗25 ]
=[ 148 554 ] =[ 18 8 ] mod 26 = [ S I ]
Decryption of fifth 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 ]

Decryption of sixth row wise matrix:

[ E T] [ 38 1725 ]=[ 4 19 ] [ 38 1725 ]


=[ 4∗3+ 19∗8 4∗17 +19∗25 ]
=[ 164 543 ] = [ 8 23 ] mod 26 = [ I X ]
So, the plain text is: “MISSISSIPPIX”. Here last letter X is
dummy, So the final plain text is: “MISSISSIPPI”.

You might also like