# Problem while decrypting Hill cipher

I have a plaintext "monday" and ciphertext "IKTIWM" and $$m=2$$. I want to find the key of the Hill cipher.

I made a matrix $$\begin{bmatrix} a_1 & a_2 \\ a_3 & a_4 \end{bmatrix}\begin{bmatrix} m \\ o \end{bmatrix} = \begin{bmatrix} I \\ K \end{bmatrix} \pmod{26}$$

$$X=\{\{m,o\},\{n,d\}\}$$, $$Y=\{\{I,K\},\{T,I\} \}$$, I want to find $$X \times K=Y$$.

I will multiply this equation with inverse($$X$$).

But for the modulo inverse you need $$gcd$$(determinant($$X), 26) =1$$ . Which is not happening here.

• I am making a matrix X={ {m,o}, {nd} },Y={ {I,K} ,{T,I} },I want to find X*K=Y; – Manoharsinh Rana Feb 1 at 11:20
• I edited it.I don't know how to write a matrix here. – Manoharsinh Rana Feb 1 at 11:23
• Hint: not all systems of 6 equations with 4 unknowns have a unique solution. Find them all. – fgrieu Feb 1 at 11:52
• these are the equations. 12a + 14b = 8 , 12c + 14d = 10 ,13a + 3d = 19 ,13c + 3d = 8 , 24b=22 , 24d= 12. I have replaced a1 with a , a2 with b , a3 with c , a4 with d. Can we solve them? – Manoharsinh Rana Feb 1 at 12:33
• you are right. But can you help me solve it? – Manoharsinh Rana Feb 1 at 12:55

$$\begin{bmatrix}7&2\\ 10& 20\end{bmatrix}, \begin{bmatrix}7&2\\ 23& 7\end{bmatrix}, \begin{bmatrix}20&15\\ 10& 20\end{bmatrix}, \begin{bmatrix}20&15\\ 23& 7\end{bmatrix}$$
are all the $$2 \times 2$$ matrices over $$\mathbb{Z}_{26}$$ would transform 'monday' to IKTIWM, the first and third have even determinant so are not invertible so the second or the fourth candidate encryption matrix is the correct one: invert them and check the rest of the text which is one is actually correct.