How would you tackle the problem of finding the key (you don't know the length) to a Hill cipher when knowing only one 12-letter word of plaintext and its corresponding ciphertext?

CONVERSATION has been encoded as SQZHUSSUDYKP with standard alphabet (A=0, Z=25). The key, as I said, is unknown with unknown size.

I am not asking for a solution, but for tips and guidance. Any help will be much appreciated.


1 Answer 1


Assuming that $2\times2$ matrix is used, and the encryption starts from the first letter of the plaintext, the key can be found by just calculating the "encryption" with size of $4$ plain- and cryptotext block.

For example, for CONV $\rightarrow$ SQZH, it would go as follows:
$$\begin{pmatrix} 2 & 14 \\ 13 & 21 \end{pmatrix}\begin{pmatrix} a & b \\ c & d \end{pmatrix}= \begin{pmatrix} 18 & 16 \\ 25 & 7 \end{pmatrix}\pmod{26}$$

Then solving for $a,b,c,d$, the key $K$ is found. As here the plaintext matrix is invertible, one can compute

$$\begin{pmatrix} a & b \\ c & d \end{pmatrix}=\begin{pmatrix} 2 & 14 \\ 13 & 21 \end{pmatrix}^{-1} \begin{pmatrix} 18 & 16 \\ 25 & 7 \end{pmatrix}\pmod{26}$$

  • $\begingroup$ What if $3\times3$ matrix is used for encryption? $\endgroup$ Commented Jun 19, 2019 at 11:52
  • $\begingroup$ You could proceed the same way, but having $9$ coefficients to be solved. $\endgroup$
    – M.P
    Commented Jun 19, 2019 at 11:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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