# Hill Cipher how to encrypt and decrypt when both “I” and “J” are in plaintext

In Hill Cipher, let's assume the key is "KEYWORD" and I want to encrypt "JUICE", so after encryption, I get "GXLBWU", and when decrypt ciphertext I get back "IUICEX" not "JUICE". So my questions are:

1. So how do a receiver know where to put "J" after decryption?
2. Does he just have to guess it?
• Firstly, remove X that has a very low frequency in English. Next, guess. – kelalaka Jul 8 '19 at 12:01

## 1 Answer

"KEYWORD" is a weird format for a Hill cipher, aren't you confused with the Playfair cipher? There you work with a 5x5 matrix where I and J are often conflated into I (as 26 is one too big) and the key-square is filled with a key word.

This is what you seem to be describing.

In the Hill cipher, the key is a 2x2 matrix over some $$\mathbb{Z}_n$$, often with $$n=26$$, which is inconveniently non-prime, not a word. No I and J merging are needed there; we can choose any $$n \ge 26$$ and add extra characters (like spaces) for convenience.

Back to your question, which I think is probably Playfair: the convention is to remove final padding (often X or Z), needed to create bigrams and then context determines whether a received I means I or J. Spaces also need to be filled in, or maybe X is used for that too. It's one of the disadvantages of hand systems with built-in limitations like this.