The Playfair cipher is a manual encryption system invented in the nineteenth century. Unlike simple substitution ciphers that encrypt individual letters, Playfair encrypts pairs of letters, known as digraphs. This makes frequency analysis more difficult and was considered a significant improvement in its day.
A 5 X 5 grid of letters is constructed from a keyword. The letters of the keyword are written into the grid first, omitting any repeated letters. The remaining letters of the alphabet are then added in order. Since the grid contains only 25 spaces, the letters I and J are combined and occupy a single cell. Thus, whenever a J appears in a message it is treated as I.
Thus, with a keyword of YELDRING, the constructed grid is:
| Y | E | L | D | R |
| I | N | G | A | B |
| C | F | H | K | M |
| O | P | Q | S | T |
| U | V | W | X | Z |
Before encryption, the plaintext is divided into pairs of letters, and then:
With a plaintext of BILLY WILLIAMS.
Remove spaces:
BILLYWILLIAMS
Split into pairs, adding an X at the end to make even:
BI LL YW IL LI AM SX
The pair LL contains a double letter, so insert X. Trailing X no longer needed:
BI LX LY WI LL IA MS
The new LL must also be separated and an X added at the end to make even:
BI LX LY WI LX LI AM SX
The pairs of letters are each encrypted using the grid following the following rules:
Following these rules, the adjusted plaintext encrypts into:
IN DW DE UG DW YG BK XD
which can then be written with the spaces removed or in any form desired.
To decrypt the cipertext TFFDXFMCLPNB using the keyword EXACTION.
with a keyword of EXACTION, the constructed grid is:
| E | X | A | C | T |
| I | O | N | B | D |
| F | G | H | K | L |
| M | P | Q | R | S |
| U | V | W | Y | Z |
Separate the ciphertext into pairs of letters:
TF FD XF MC LP NB
The pairs of letters are each decrypted using the grid and the following rules:
Following these rules, the ciphertext decrypts into:
EL LI EG RE GS ON or probably ELLIE GREGSON