Hill cipher: How to find an unknown key of unknown size
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.
known-plaintext-attack hill-cipher
Christo TodorovChristo Todorov
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}$$
M.PM.P
$\begingroup$ What if $3\times3$ matrix is used for encryption? $\endgroup$ – Christo Todorov Jun 19 '19 at 11:52
$\begingroup$ You could proceed the same way, but having $9$ coefficients to be solved. $\endgroup$ – M.P Jun 19 '19 at 11:56
Not the answer you're looking for? Browse other questions tagged known-plaintext-attack hill-cipher or ask your own question.
Hill Cipher known plaintext attack
Hill cipher, unknown letter value
Hill cipher cryptanalysis - known plaintext known key size
Proving that an encryption scheme is susceptible to certain attacks
Clarification on Hill Cipher crib dragging technique