## Section6.1Playfair Cipher

We are returning to some older ciphers to introduce the concept of block ciphers. Block ciphers encrypt blocks of letters of a fixed size and the encryption of the entire block is dependent on each letter in the block. The first block cipher we will discuss is the Playfair Cipher which dates back to the 1800's. It was used as a field cipher by the British in World War I and also briefly by the American Army during 1917-1918. This cipher encrypts a message using blocks of two letters. Usually a Playfair cipher uses a keyword to arrange the alphabet in a five-by-five grid. Since the alphabet is 26 letters, we must double up one box. It is traditional to use I to represent both I and J. It should be clear from the context whether I or J is the correct choice of letter to recover the plaintext.

To use the keyword PLAYFAIR we insert the letters of the keyword, removing any double letters, and then enter the remainder of the alphabet starting from the beginning after the keyword.

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

Of course, a random arrangement of letters would be more secure but harder to remember and use.

To encipher a message using the Playfair square we first break our message into blocks of two letters. The Playfair square cannot encrypt a block of two identical letters, so anytime the plaintext would have two of the same letters in a block we separate them with some letter, usually an X. We must always have blocks of two letters, so if the last block would only have onen letter, we will usually fill that last block with an X also.

Plaintext: MEET UP AT THE EAGLE

As we start grouping in blocks of two, ME ET UP AT TH EE, we come to the double letters EE. So we need to insert an X to separate the Es. Note that we do not need to separate the two Es in MEET since they do not end up in the same block.

Plaintext in blocks of two: ME ET UP AT TH EX EA GL EX

Note the last block had a single letter, so we filled that with an X to get a two letter block.

To encrypt the plaintext ME ET UP AT TH EX EA GL EX we first identify where M and E are located in the Playfair square.

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

M and E are both in the third row, so we shift each letter to the right one space, wrapping around for the M since its in the last column. So the plaintext ME encrypts as EG.

For the second block in the plaintext we find E and T in the Playfair square.

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

E is in the third row and the first column and T is in the fourth row and the fifth column. The first cipher text letter will be in the same row as E but with the column location of T, so it will be in the third row but fifth column =M. The second cipher text letter will be in the same row as T but in the column position of E, so it will be in the fourth row and first column position =N. Thus, our second pair of cipher text letters is MN. Alternatively, you might think of E and T as corners of a rectangle, and the ciphertext letters will be located at the other two corners of a rectangle.

For the third block in the plaintext we find U and P in the Playfair square.

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

U and P are in the same column so we shift each letter down by one spot, wrapping around to the top of the same column at the bottom of the column. So UP encrypts as PI.

We continue for each block of two letters.

 plaintext: ME ET UP AT TH EX EA GL EX ciphertext: EG MN PI FQ QM KU HP OR KU

Note that there are five Es in this message but most of them get encrypted as a different letter in the ciphertext depending on the other letter that is in the same block as the E.

To decrypt we reverse the process. For Case 1, encryption and decryption are the same. However, for letters in the same row or column you must move one letter in the reverse direction (to the left for letters in the same row, and up for letters in the same column.)