Playfair Cipher


The Playfair Cipher was created in 1854 by Charles Wheatstone. He names it after his friend, Lyon Playfair. It was originally used to send encoded messages in telegraphs but later was used in World War I and World War II. Its supposed difficulty made it difficult to figure out how to decode. However, you can decode this cipher on a piece of paper with just a pencil.

First off, you are going to need a grid.

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

As you can see there is no “J”. We will substitute that with “I”.

What you want to do to encode a message is to take the message and write it all out with no spaces.

So the message “Happy Birthday!” would become “HAPPYBIRTHDAY”.

Then you want to separate the message into pairs of 2.

So the message would become “HA PP YB IR TH DA Y”.

If there are any letters leftover with no pair, end it off with an “X”, and if there are any repeating letters in a pair, replace the last letter of that pair with an “X”.

So the message would become “HA PX YB IR TH DA YX”.

This will be easy to spot when decoding because the letter “X” appears few and far between in any message.

3 rules apply to the grid when encoding.

  1. 2 letters of a pair will be in the same row (Left to Right).

  2. In this case, you will take the letter that is directly left of the first letter of the pair, and the letter that is directly left of the second letter of the pair for the encoded message. If the letter you are encoding runs off the side of the grid, wrap around and use the one that is on that side of the row.

  3. 2 letters of a pair will appear in the same column (Up and Down).

  4. In this case, you will take the letter that is directly under the first letter of the pair, and the letter that is directly under the second letter of the pair for the encoded message. If the letter that you are encoding runs off the bottom of the grid, wrap around and use the letter that is on top of that column.

  5. 2 letters of a pair will form a “box” with both letters of a pair appearing on the diagonals of the “box”.

  6. In this case, you will take the first letter and run your finger to the opposite side of the box on the row (side to side) and use that letter. You will take the second letter and run your finger to the opposite side of the box on the row (side to side) and use that letter.

Now we are ready to start encoding!

“HA” would become “FC” (box method)

“PX” would become “NZ” (box method)

‘YB” would become “WD” (box method)

“IR” would become “GT” (box method)

“TH” would become “SI” (box method)

“DA” would become “EB” (row method)

“YX” would become “ZY” (row method)

REMEMBER, THIS METHOD IS FOR ENCODING! TO DECODE, YOU MUST DO IT BACKWARDS!

The message “HAPXYBIRTHDAYX”, when encoded, would become “FCNZWDGTSIEBZY”

The first “A” becomes “C”, and the second “A” becomes “B”. They are both different values when encoded! This is why it is my favorite way to encode messages!

Happy decoding!