# Find the Hill cipher key matrix that can realize this permutation

Find the Hill cipher key matrix $K$ that can realize the permutation $$f: (1,2,3,4,5) \to (3,5,1,4,2).$$

I am not sure how to find a $5\times 5$ matrix that satisfies this. My guess is

$$K=\begin{bmatrix} 0 & 0 & 1 & 0 & 0\\0 & 0 & 0 & 0 & 1\\ 1 & 0 & 0 & 0 & 0\\ 0 & 0 & 0 & 1 & 0\\0 & 1 & 0 & 0 & 0\\ \end{bmatrix}.$$

I am not sure if this is correct.

• Could you please clarify what are the alphabet and the block length? – Andreas Caranti Feb 16 '13 at 18:29
• The alphabet is A-Z so it will be mod 26, I am not sure about the block length. – Dreamer78692 Feb 16 '13 at 18:41
• Now, wouldn't the block size here be $5$? – Thomas Feb 16 '13 at 19:03
• I think your matrix is quite ok. – Seyhmus Güngören Feb 16 '13 at 19:03

When your key is $K$ and your plaintext is for example $HELLO$ corresponding to the vector $$\pmatrix{8 \\ 5 \\ 12\\ 12\\ 15}$$ then you get $$\pmatrix{ 0 & 0 & 1 & 0 & 0\\0 & 0 & 0 & 0 & 1\\ 1 & 0 & 0 & 0 & 0\\ 0 & 0 & 0 & 1 & 0\\0 & 1 & 0 & 0 & 0} \pmatrix{8 \\ 5 \\ 12\\ 12\\ 15} = \pmatrix{12\\15\\8\\12\\5}.$$ So the ciphertext is $LOHLE$. This corresponds exactly to the permutation that you gave.