3
$\begingroup$

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.

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

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.

$\endgroup$
0
$\begingroup$

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 )

$\endgroup$

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.