Playfair Cipher Example
Using the keyword "COMPUTER", the key table would be initialized to
Playfair Cipher Table
C |
O |
M |
P |
U |
T |
E |
R |
A |
B |
D |
F |
G |
H |
I |
J |
K |
L |
N |
Q |
S |
V |
W |
Y |
Z |
Let's encrypt the message "Hi there Mary". Change to upper-case, remove the spaces, and since the message has an odd number of character, append an 'X' -- "HITHEREMARYX". Now, encrypt two letters at a time.
- Locate 'H' and 'I' in the table. Since they are in the same row, encrypt them as the
letters to their immediate right. 'H' becomes 'I'. Since 'I' is in the last column,
wrap around to the first column so that 'I' becomes 'D'. So HI is encrypted as ID.
- Locate 'T' and 'H' in the table. Since they are not in the same row or same column,
consider them as corners of a rectangle. 'T' is first encrypted as the corner of
the rectangle made up of 'T's row, and 'H's column. 'T' becomes 'A'. Similarly, encrypt
'H' as the letter in 'H's row, but 'T's column. 'H' becomes 'D'. So TH is encrypted as AD.
- Locate 'E' and 'R' in the table. Since they are in the same row, encrypt them as
the letters to their immediate right. 'E' becomes 'R' and 'R' becomes 'A'. so ER becomes RA.
- Locate 'E' and 'M' in the table. Since they are not in the same row or same column,
consider them as coners of a rectangle. 'E' is first encrypted as the corner of the rectanlge
made up of 'E's row and 'M's column. 'E' becomes 'R'. Simarilarly, encryprt 'M' using
the intersection of 'Ms row and 'E's column. 'M' becomes 'O'. So EM becomes RO.
- Locate 'A' and 'R'. Since ther are in the same row, encrypt them as the letters
to their immediate right. 'A' becomes 'B' and 'R' becomes 'A'. So AR becomes BA.
- Finally, since the last pair contains an 'X', they are not changed. 'YX' remains 'YX'
So when complete, the message "Hi there Mary" becomes ID AD RA RO BA YX
Try these other pairs using the matrix above.
- TR (same row)
- OF (same column)
- PY (same column)
- RB (same row)
- FQ (not same row, column)
- PD (not same row, column)
- FL (not same row, column)