The Playfair Cipher was popularised by Lyon Playfair, but it was invented by Charles Wheatstone, one of the pioneers of the telegraph. The cipher replaces each pair of letters in the plaintext with another pair of letters, so it is a type of digraph cipher.As an example, let's encrypt the message 'Meet me at the Hammersmith Bridge tonight'.
Firstly, the sender and receiver must agree on a keyword. In this example, the keyword is Wheatstone's name, CHARLES. The letters of the alphabet are written in a square, as shown, beginning with the keyword and with I-J combined into one element. Now, click on 'Form Digraphs' to break the message into pairs of letters. The two letters in a digraph must be different, so an X has been added to split the double M in 'hammersmith'.
Encryption depends on the type of digraph. The digraphs fall into one of three categories - both letters are in the same row, or both letters are in the same column, or the letters share neither a row nor a column.
- If both letters are in the same row, then they are replaced by the letters to the immediate right of each one; 'mi' becomes 'NK'. If a letter is at the end of a row , it is replaced by the letter at the beginning; 'ni' becomes 'GK'.
- If both letters are in the same column, then they are replaced by the letter immediately beneath each one; 'ge' becomes 'OG'. If a is at the bottom of a column, it is replaced by the letter at the top; 've' becomes 'CG'.
- If the digraph letters are neither in the same row nor the same column, the rule differs. To encipher the first letter, look along its row until you reach the column containing the second letter; the letter at this intersection replaces the first letter. To encipher the second letter, look along its row until you reach the column containing the first letter; the letter at the intersection replaces the second letter. Hence, 'me' becomes 'GD'.
To encipher a message, type it into the plaintext box, click the button labelled 'From Digraphs' and then click 'Encipher Plaintext'.