# How to encrypt letters less than block n using Hill Cipher

I am learning about Hill Cipher and know that it is a block cipher where each block of n letters (considered as an $n$-component vector) is multiplied by an invertible $n \times n$ matrix, again modulus $26$.

The article did not touch on what happens if the the block of letters is less than length $n$.

Eg: Assume I am supposed to encrypt 100 letters – how do I encrypt the last 22 letters?

I was thinking of padding similar to MD5, or are there other methods to resolve this issue? If so, what are those methods?

• – Sufiyan Ghori Oct 15 '14 at 14:45
• In the Hill Cipher, the number of components in the vector (that you note $n$) is not usually the same as the modulus you set at $26$. $n=3$ is typical, and makes the padding issue less relevant. Notice that the cipher is slightly less vulnerable if the modulus is prime. – fgrieu Oct 27 '14 at 15:34