Hill cipher

Number Theory Level pending

Given the matrix A = 4 5 1 2 m o d 26 A= \begin{vmatrix}{4} && {5} \\ {1} && {2}\end{vmatrix} \bmod{26} , use a Hill cipher to decipher the message R Q T I C O D E W W M G H I RQTICODEWWMGHI using modulo 26, where A 0 , B 1 , , Z 25 , A \rightarrow 0, B \rightarrow 1, \ldots , Z \rightarrow 25, and enter the result as a string of integers.

What does the deciphered message state?


The answer is 27813418413422244017.

This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try refreshing the page, (b) enabling javascript if it is disabled on your browser and, finally, (c) loading the non-javascript version of this page . We're sorry about the hassle.

2 solutions

Rocco Dalto
Jan 3, 2017

Note: det ( A ) = 3 \: \det(A) = 3 and gcd ( 3 , 26 ) = 1 \gcd(3,26) = 1 , so for each block X j X_{j} the system A X j = B j m o d 26 A * X_{j} = B_{j} \bmod{26} has a unique solution, where ( 1 < = j < = 7 ) (1 <= j <= 7) .

Using seven blocks for R Q T I C O D E W W M G H I RQTICODEWWMGHI we obtain:

17 16 17\: 16

19 8 19 \: 8

2 14 2 \: 14

3 4 3 \: 4

22 22 22 \: 22

12 6 12 \: 6

7 8 7 \: 8

A X j = B j X j = A 1 B j A * X_{j} = B_{j} \implies X_{j} = A^{-1} * B_{j}

C = A I = [ 4 5 1 0 1 2 0 1 ] m o d 26 C = A|I = \left [\begin{array}{cc|cc} 4 & 5 & 1 & 0 \\ 1 & 2 & 0 & 1 \\ \ \end{array} \right] \bmod{26}

Using the row operation: R o w 1 R o w 2 Row_{1} \leftrightarrow Row_{2} \implies

C = [ 1 2 0 1 4 5 1 0 ] m o d 26 C = \left [\begin{array}{cc|cc} 1 & 2 & 0 & 1 \\ 4 & 5 & 1 & 0 \\ \ \end{array} \right] \bmod{26}

Using the row operation: 22 R o w 1 + R o w 2 22 * Row_{1} + Row_{2} \implies

C = [ 1 2 0 1 0 23 1 22 ] m o d 26 C = \left [\begin{array}{cc|cc} 1 & 2 & 0 & 1 \\ 0 & 23 & 1 & 22 \\ \ \end{array} \right] \bmod{26}

Using the row operation: 17 R o w 2 17 * Row_{2} \implies

C = [ 1 2 0 1 0 1 17 10 ] m o d 26 C = \left [\begin{array}{cc|cc} 1 & 2 & 0 & 1\\ 0 & 1 & 17 & 10 \\ \ \end{array} \right] \bmod{26}

Using the row operation: 24 R o w 2 + R o w 1 24 * Row_{2} + Row_{1} \implies

C = [ 1 0 18 7 0 1 17 10 ] m o d 26 C = \left [\begin{array}{cc|cc} 1 & 0 & 18 & 7\\ 0 & 1 & 17 & 10 \\ \ \end{array} \right] \bmod{26}

\implies

A 1 = [ 18 7 17 10 ] m o d 26 A^{-1} = \left [\begin{array}{cc|c} 18 & 7\\ 17 & 10 \\ \ \end{array} \right] \bmod{26}

Note: A A 1 = I A * A^{-1} = I

Deciphering the first block [ 17 16 ] : \left [\begin{array}{cc|c} 17 \\ 16 \\ \ \end{array} \right] \textbf{:}

X 1 = A 1 B 1 m o d 26 = [ 18 7 17 10 ] [ 17 16 ] m o d 26 = [ 2 7 ] m o d 26 X_{1} = A^{-1} * B_{1} \bmod{26} = \left [\begin{array}{cc|c} 18 & 7\\ 17 & 10 \\ \ \end{array} \right] * \left [\begin{array}{cc|c} 17 \\ 16 \\ \ \end{array} \right] \bmod{26} = \left [\begin{array}{cc|c} 2 \\ 7 \\ \ \end{array} \right] \bmod{26} :

Deciphering the second block [ 19 8 ] : \left [\begin{array}{cc|c} 19 \\ 8 \\ \ \end{array} \right] \textbf{:}

X 2 = A 1 B 2 m o d 26 = [ 18 7 17 10 ] [ 19 8 ] m o d 26 = [ 8 13 ] m o d 26 X_{2} = A^{-1} * B_{2} \bmod{26} = \left [\begin{array}{cc|c} 18 & 7\\ 17 & 10 \\ \ \end{array} \right] * \left [\begin{array}{cc|c} 19 \\ 8 \\ \ \end{array} \right] \bmod{26} = \left [\begin{array}{cc|c} 8 \\ 13 \\ \ \end{array} \right] \bmod{26}

Repeat the same procedure for the remaining five blocks.

Our deciphered blocks are:

2 7 2 \: 7

8 13 8 \: 13

4 18 4 \: 18

4 13 4 \: 13

4 22 4 \: 22

24 4 24 \: 4

0 17 0 \: 17

Our plain text message is:

C H I N E S E N E W Y E A R CHINESENEWYEAR

As a string of integers we have: 27813418413422244017 27813418413422244017 .

The Chinese New Year is on January 28, 2017. \textbf{ The Chinese New Year is on January 28, 2017.}

Paul Hindess
Jan 4, 2017

My approach was the same as Rocco, except for two things.

First off, I wasn't sure whether the given matrix was the enciphering matrix or deciphering matrix. I tried it as the deciphering matrix and got the first two letters SX which seemed unlikely.

So we need to find the inverse matrix - but with integers and mod 26. I wasn't sure how to do this so took a different approach.

I worked out the inverse matrix (in my view more conventionally?) as:

1 3 [ 2 5 1 4 ] \frac13 \left[ {\begin{array}{cc} 2 & -5 \\ -1 & 4 \ \end{array} } \right] .

This means that [ 4 5 1 2 ] [ 2 5 1 4 ] = [ 3 0 0 3 ] \left[ {\begin{array}{cc} 4 & 5 \\ 1 & 2 \ \end{array} } \right]\left[ {\begin{array}{cc} 2 & -5 \\ -1 & 4 \ \end{array} } \right]=\left[ {\begin{array}{cc} 3 & 0 \\ 0 & 3 \ \end{array} } \right] .

Now, as 3 × 9 = 27 = 1 m o d 26 3\times 9 = 27 = 1 \mod 26 , we can calculate:

9 × [ 2 5 1 4 ] = [ 18 45 9 36 ] = [ 18 7 17 10 ] m o d 26 9\times\left[ {\begin{array}{cc} 2 & -5 \\ -1 & 4 \ \end{array} } \right]=\left[ {\begin{array}{cc} 18 & -45 \\ -9 & 36 \ \end{array} } \right]=\left[ {\begin{array}{cc} 18 & 7 \\ 17 & 10 \ \end{array} } \right]\mod 26 .

From here, I proceeded as Rocco did...

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...