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.

  • $\begingroup$ I am making a matrix X={ {m,o}, {nd} },Y={ {I,K} ,{T,I} },I want to find X*K=Y; $\endgroup$ – Manoharsinh Rana Feb 1 '19 at 11:20
  • $\begingroup$ I edited it.I don't know how to write a matrix here. $\endgroup$ – Manoharsinh Rana Feb 1 '19 at 11:23
  • $\begingroup$ Hint: not all systems of 6 equations with 4 unknowns have a unique solution. Find them all. $\endgroup$ – fgrieu Feb 1 '19 at 11:52
  • $\begingroup$ 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? $\endgroup$ – Manoharsinh Rana Feb 1 '19 at 12:33
  • $\begingroup$ you are right. But can you help me solve it? $\endgroup$ – Manoharsinh Rana Feb 1 '19 at 12:55

These modular equations are not uniquely solvable:

$$\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.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.