The Playfair Cipher is a method of encrypting text by using pairs of letters and a 5×5 grid based on a keyword. Each letter is placed in the grid, and duplicate letters are removed. Usually, “I” and “J” share a single space in the grid.
Example:
Keyword: MONARCHY
Plaintext: HELLO
Steps:
Divide the plaintext into pairs, like “HE,” “LL,” and “OX” (add an “X” if needed to make pairs).
Replace each pair using these rules:
If both letters are in the same row of the grid, replace them with the letters to their immediate right.
If both are in the same column, replace them with the letters directly below.
If they form a rectangle, replace them with the letters in the same row but in the opposite corners of the rectangle.
The result is an encrypted text. For “HELLO,” the ciphertext could look like “GCNLXR.”