Playfair Cipher

The Playfair Cipher is a manual symmetric encryption technique that encrypts pairs of letters (bigrams) instead of single letters. It was invented by Charles Wheatstone in 1854 but became known as the Playfair Cipher after it was promoted by Lord Playfair. This cipher was used extensively during the World War I era for secure military communications, as it provided better security than simple substitution ciphers by addressing frequency analysis vulnerabilities.

The Playfair Cipher uses a 5x5 square grid filled with letters of the alphabet. To fit the 25 letters of the English alphabet into the grid, the letters I and J are usually combined. The plaintext is divided into pairs of letters. If a pair consists of the same letter (like "LL"), an X is inserted between them (making it "LX" in this case). If there's an odd number of letters, an X is added to the end. The pairs are then encrypted based on their positions in the grid.

Example:

Consider the keyword "MONARCHY." The grid would look like this after filling in the letters:

M O N A R
C H Y B D
E F G I/J K
L P Q S T
U V W X Z

For the plaintext "HELLO," we first convert it into pairs: "HE," "LX," "O."

  1. Encrypting "HE":
    • H (row 2, column 2) and E (row 3, column 1) are in different rows and columns.
    • The letters are replaced with the letters in their respective rows but opposite corners:
    • H → C (row 2, column 1), E → Y (row 3, column 2).
    • So "HE" becomes "CY."
  2. Encrypting "LX":
    • L (row 4, column 1) and X (row 5, column 4) are in different rows and columns.
    • L → U (row 4, column 4), X → V (row 5, column 1).
    • So "LX" becomes "UV."
  3. Encrypting "O":
    • O (row 1, column 2) and we add an X to make it "OX."
    • O → N (row 1, column 3), X → Z (row 5, column 5).
    • So "O" becomes "NZ."
  4. Resulting Ciphertext:
    • The plaintext "HELLO" can be encrypted to "CYUVNZ."

Mapping Table:

Here's how the Playfair encryption works for the letters involved:

PairRow/ColEncrypted Pair
H EH (2, 2), E (3, 1)C Y
L XL (4, 1), X (5, 4)U V
O (X)O (1, 2), X (5, 5)N Z

This table illustrates the pairwise encryption process in the Playfair Cipher, showing how it enhances security by making the analysis of letter frequencies more complex, thus making it a useful cipher in historical contexts where secrecy was paramount.