1
$\begingroup$

How can we encrypt a text in Hill Cipher with a key matrix that is 3x3 when the plaintext is even like "ATTACKS"? Do we need to add padding like "x" or "z" to make the matrix equal? Thanks.

$\endgroup$

2 Answers 2

1
$\begingroup$

It's indeed standard to add pre-agreed padding characters at the end to make the plain text a multiple of $n$ when we use an $n \times n$ encryption matrix.

So your encoded plain text could be

$$\begin{bmatrix} \operatorname{enc}(A)\\ \operatorname{enc}(T) \\ \operatorname{enc}(T) \end{bmatrix} \begin{bmatrix} \operatorname{enc}(A)\\ \operatorname{enc}(C) \\ \operatorname{enc}(K) \end{bmatrix} \begin{bmatrix} \operatorname{enc}(S)\\ \operatorname{enc}(X) \\ \operatorname{enc}(X) \end{bmatrix} $$

where $\operatorname{enc}(x)$ is the encoding of the character $x$ in the number ring or field the matrix is taken over, and when we use 'X' as a padding character.

$\endgroup$
1
$\begingroup$

To make the plaintext matrices equal, you could use padding with a null character, such as using "X". For example with "ATTACKS", you would get the following vectors:

$$ \begin{bmatrix}A\\T\\T\end{bmatrix}\ \begin{bmatrix}A\\C\\K\end{bmatrix}\ \begin{bmatrix}S\\X\\X\end{bmatrix}\ $$

$\endgroup$

Your Answer

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

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