# The Playfair Cipher

```The Playfair Cipher
The Playfair cipher was promoted by Lyon Playfair in the 1800's, but invented by his
friend Charles Wheatstone - a pioneer in the telegraph. It was eventually used by the
British War Office, using it first in the Boer War. But it can be attacked successfully.
Indeed, Kerkhoff first wrote about a systematic method to break the Playfair Cipher.
The key is a 5 by 5 square of 25 letters. (We eliminate J, using I if it occurs in the
plaintext.) For example,
G
E
Q
U
W
A
L
N
S
V
B
C
H
O
T
R
X
D
K
P
I
Z
Y
F
M
Next the plaintext is broken up into digraphs. The two letters of each digram must be
different so an x is usually inserted between double lettered digraphs. For instance, the
message:
MEET ME AT CHAPEL WALK NOON
is broken into digraphs:
ME ET ME AT CH AP EL WA LK NO ON
An additional dummy letter may need to be added to the end.
Each digraph is then encrypted. Each digraph is one of three types: both letters in same
row, both in same column, or neither. If both letters are in the same row, they are replaced
by the letters to the immediate right of each, wrapping around the row if necessary. For
example, EL is replaced by LC, and NY is replaced by HQ. If both letters are in the same
column, they are replaced with the letters immediately beneath each, For example, MF is
replaced by IM.
If neither, then take the first letter and look along its row until you come to the column of
the second letter. Replace the first letter with what is there. Now do the same for the
second letter. For example, AT is replaced by BV.
Decryption is just the inverse of these operations.
Thus the ciphertext for our message would be:
WZ CW WZ BV HO RV LC VG XS HS SH
(Of course these letters would usually be written in groups of five.)
Homework: Using the above square, decrypt the message: HOLSE QUXNF KIQUW QHVZN
The ADFGVX Cipher was the most famous cipher used in WW I. Introduced by the
Germans in March 1918 before their big push to Paris in June, the Allies were in total
ignorance of their plans until Frenchman Georges Painvin broke it after many weeks of
continual effort. The Allies then found the point of the offensive, reinforced their lines
and repelled the attack, effectively ending any further serious German threat and
hastening the end of the war.
The ADFGVX Cipher double-encrypts messages - first with a form of substitution cipher,
then with a transposition.
The first key is a 6 by 6 grid of the 26 letters and 10 digits. Each row and column is
identified by one of the letters ADFGVX. For example:
A
D
F
G
V
X
A
8
l
7
j
x
9
D
p
t
k
u
s
e
F
3
4
b
6
v
y
G
d
o
c
w
i
0
V
1
a
5
g
r
f
X
n
h
z
m
2
q
Each letter of the plaintext is replaced by the pair of letters indicating the row and
column. For example, c would be replaced by FG.
For example the plaintext: attack at dawn
would be encrypted first as: DV DD DD DV FG FD DV DD AG DV GG AX
If that were it, this would be easy to break. (How?) But this cipher has a second stage,
which is columnar transposition. Suppose the second key is RHINO. We arrange the
letters from the first phase in columns under the 5 letters, rearrange the columns so the
letters in the key are in alphabetical order and print out the ciphertext in columns:
R
D
D
F
D
G
H
V
D
D
A
G
I
D
V
D
G
A
N
D
F
V
D
X
O
D
G
D
V
H
V
D
D
A
G
I
D
V
D
G
A
N
D
F
V
D
X
O
D
G
D
V
R
D
D
F
D
G
So, the ciphertext would be: VDDAG DVDGA DFVDX DGDVD DFDG
Decryption is simply the reverse operations.
Homework: Using the above square and the key ROCKY, decrypt GDXGD DVAVG DDGDX VGDDV
XVXXG VVDVD XDFDD DDDAV FVXX
```