3

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.

JohnD
  • 14,392
Dreamer78692
  • 488
  • 6
  • 14

2 Answers2

1

I hope that I understand you question right. The block size corresponds to the size of the matrix. So the block size in this case is five.

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.

Thomas
  • 43,555
0

I know this is a little late. But I think this can be generalised as follows.

Say the Key Matrix (for the Hill Cipher ) we need is K (which is an mxm matrix, with 'm' being the plain text's and cipher text's length) . Let 'f' be the permutation function we have in hand . (For example , in your case f(1)=3 , f(2)=5 , f(3)=1 and so on)

Then the Key matrix can be formalised as a matrix full of zeros except that
k(i,j) = 1 , if j=f(i) ( where k(i,j) is the element in the intersection of i'th row and j'th column )