Chapter VIII

Case 8. The Playfair cipher. This is the English military field cipher; as the method is published in English military manuals and as it is a cipher of proven reliability, it may be met with in general cipher work. The Playfair cipher operates with a key word; two letters are substituted for each two letters of the text.

The Playfair cipher may be recognized by the following points: (a) It is a substitution cipher, (b) it always contains an even number of letters, (c) when the cipher is divided into groups of two letters each, no group consists of the repetition of the same letter as SS or BB, (d) there will be recurrence of pairs throughout the message, following in a general way, the frequency table of digraphs of pairs, (e) in short messages there may be recurrence of cipher groups representing words or even phrases, and these will always be found in long messages.

In preparing a cipher by this method, a key word is chosen by the correspondents. A large square, divided into twenty-five smaller squares, is constructed as shown below and the letters of the key word are written in, beginning at the upper left hand corner. If any letter recurs in the key word, it is only used on the first occurrence. The remaining letters of the alphabet are used to fill up the square. It is customary to consider I and J as one letter in this cipher and they are written together in the same square.

If the key word chosen is LEAVENWORTH, then the square would be constructed as follows:

LEAVN
WORTH
BCDFG
IJKMPQ
SUXYZ

The text of the message to be sent is then divided up into groups of two letters each, and equivalents are found for each pair.

Every pair of letters in the square must be: Either (1) in the same vertical line. Thus in the above example each letter is represented in cipher by that which stands next below it, and the bottom letter by the top one of the same column; for instance, TY is represented by FV.

Or (2) in the same horizontal line. Each letter in this case is represented by that which stands next on its right, and the letter on the extreme right by that on the extreme left of the same horizontal line with it; for instance RH is represented by TW.

Or (3) at opposite corners of a rectangle. Each letter of the pair is represented by the letter in the other corner of the rectangle in the same horizontal line with it; for instance TS is represented by WY.

If, on dividing the letters of the text into pairs, it is found that a pair consists of the same letter repeated, a dummy letter, as X, Y, or Z, should be introduced to separate the similar letters.

If the message to be sent were “The enemy moves at dawn,” it would be divided into pairs:

THEXENEMYMOVESATDAWN
and enciphered:HWAUALAKXPTELUVRMRHL

The message is then broken up into groups of five letters for transmission.

To decipher such a cryptogram, (knowing the key word), the receiver divides it into pairs, and from his table finds the equivalent of these pairs, taking the letter immediately above each, when they are in the same vertical line; those immediately on the left, when in the same horizontal line; and those at opposite angles of the rectangle when this is formed.

It is evident, from the foregoing description, that any letter of the plain text may be represented in cipher by one of five letters, viz: The one next below it and the other four letters in the same horizontal line with it in the square. Take, for example, the letter D of the plain text, in combination with each of the other letters of the alphabet. We have, using the key LEAVENWORTH:

DADBDCDEDFDGDHDIDKDLDMDNDODPDQDRDSDTDUDVDWDXDYDZ
MRFCFDCAFGFBGRBMCMBAMXGACRFMGMMDBXFRCXFABRMAFXGX
This gives D represented byBCFGM
44844times,
and, connected withthese five letters representing D,
we haveARDMXBCG
55245111times.

Note that these letters are those of the vertical column containing D plus the letters B, C and G, of the horizontal line containing D.

Lieut. Frank Moorman, U. S. Army, has developed a method for determining the letters which make up the key word in a Playfair cipher. In the first place, a key word necessarily contains vowels in the approximate proportion of two vowels to three consonants and it is also likely that a key word will contain other common letters. This key word is placed in the first row or rows. Now if a table is made, showing what letters in the cipher occur with every letter, it will be found that the letters having the greatest number of other letters in combination with them are very likely to be letters of the key word, or in other words, letters occurring in the first or second lines. An example will make this clear:

Message

DB FN EX TZ MF TO VB QB QT OB XA OF PR TZ EQ RH QK QV DX OK AB PR QI EL TV KE EX XS FS BP WD BO BY BF RO EA BO RH QK QV TX GU EL AB TH TR XN ON EA AY XH BO HN EX BS HR QB ZM SE XP HF GZ UG KC BD PO EA AY XH BO XP HF KR QI AB PR QI EL BX FZ BI SE FX PB RA PR QI WC BR XD YG TB QT EA AY XH BO HN EX BS HR QB PR QI EL BX BT HB QB NF SI SE BX NU XP BU RB XB QR OX BA TB RH BP WD RP RO GU GX QR SE ZY OX BA EL AX CW BY BA SX RK RO PR HB OP BD PI CN OX EM RP KR XT EL AX CW EQ FZ SX EL RH RO PR HB UX DA SE XN ZN GU EL BX FS DG DB TB ZL VE RH BO RQ.

From this message, we make up the following table, considering the letters of each pair:

First Letters of Pairs

ABCDEFGHIKLMNOPQRSTUVWXYZ
A31411
B3231141311
C11
D221
E151
F12111
G1111
H513
I1151
K121
L81
M11
N112121
O6141
P2123
Q2
R122721
S221
T121
U131
V2
W2
X1514113211
Y51
Z212

From this table we pick out the letters B, E, F, O, R, T, X, as tentative letters of the key word on account of the variety of other letters with which they occur. As there are but two vowels for seven letters, we will add A to the list on account of its occurrences with B, D, E, R, and X. This leaves the letters for the bottom lines of the square as follows:

.....
...CD
GHIJKL
MNPQS
UVWYZ

Referring to the table again we find the most frequent combination to be EL, occurring 8 times, with no occurrence of LE. Now, TH is the commonest pair in plain text, and HT is not common. The fact that H occurs in the same horizontal line with L and that E and T are probably in the key, will lead us to put E in the first line over H and T in the first line over L, so as to make EL equal TH.

The next most frequent combination is PR occurring 7 times, with RP occurring twice. In the square as partially arranged, PR equals M_ or N_ or Q_ or I_. We may eliminate all these except N_, and this N_ could only be NO or NA, so that we will put, tentatively the R in the second line over H and the O and A in the same line over IJ. We have then:

.E..T
.RAOCD
GHIJKL
MNPQS
UVWYZ

Let us now check this by picking out the combinations beginning with EL and seeing if the table will solve them. We find, ELTV, ELAB, ELBXFZ, ELBXBT, ELAXCWBY, ELAXCWEQ, ELRH, ELBXFS. Now, on the assumption that the letter after EL represents E, we have it represented by A three times, B three times, R once and T once. This requires that A and B be put in the same horizontal line with E, since T is already there, and R is tentatively under E.

The combination ELTV now equals THEZ. If the T were moved one place to the left, it would be THEY, a more likely combination, but this requires the L to be moved one place to the left also, by putting I or K in the key word and taking out O, R or X and returning it to its place in the alphabetical sequence. The most frequent pairs containing O are B O six times, R O four times, and O X three times. Now these pairs equal respectively E N, E S and H E, if O is put between N and P in the fourth line. We will therefore cease to consider it as a letter of the the key word. The combination ELAB can only be THE_ on the assumption that A is the first letter to the right of E. The combination ELBX occurs three times. If it represents THE_, the B must be the first letter of the first line and the X must now be placed under E where the R was tentatively put. We can get THE_ out of ELRH by putting R in the first line or leaving it where it is, but the preponderance of the BX combination should suggest the former alternative.

A new square showing these changes will look like this:

BEATR
.X...
GH.LM
NOPQS
UVWYX

As I put in the space under B will give the word BEATRIX and as a vowel is clearly necessary there, we will so use the IJ and leave K between H and L. This leaves C, D and F to be placed. It appeared at first that F was in the key but if it is in the second line, in proximity to the letters of the first line, it will give the same indications. Completing the square then, we have

BEATR
IJXCDF
GHKLM
NOPQS
UVWYZ

With this square, the message is deciphered without difficulty.

“It is very frequently neces(x)sary to employ ciphers and they have for many centuries been employed in the relations betwe(x)en governments, for com(x)munication betwe(x)en com(x)manders and their subordinates and particularly betwe(x)en governments and their agents in foreign countries; there are many cases in history where the capture of a message not in cipher has made the captors of the message victorious in their military movements.”

It will be seen that the method of Lieut. Moorman enabled us to pick out six letters of the key word out of eight letters chosen tentatively. The reason for the appearance of F has already been noted; the letter O occurred with many other letters because it happened to remain in the same line with N and S and to be under H. It thus was likely to represent any of these three letters which occur very frequently in any text.