1 of 29

The Playfair Cipher

S

H

A

W

N

B

C

D

E

F

G

I

K

L

M

O

P

Q

R

T

U

V

X

Y

Z

The Bacon Station

2 of 29

The Playfair Cipher:

The cipher was invented in 1854 by Charles Wheatstone, but was named after Lord Playfair who promoted the use of the cipher.

By Samuel Laurence - Page 53 of Apples to Atoms by W. D. Hackmann (London, ca. 1986), Public Domain, https://commons.wikimedia.org/w/index.php?curid=4864902

Charles Wheatstone

Lord Lyon Playfair

Public Domain

http://en.wikisource.org/wiki/Page:Popular_Science_Monthly_Volume_28.djvu/10 |Date = 1885-1886 |Author = Unknown Category:Popular Science Monthly

3 of 29

About Playfair Ciphers:

  • The Playfair cipher is a digraph (pairs of letters) substitution cipher.
    • All non-letters are ignored and not encoded.
    • Numbers, spaces, and punctuation are also skipped.

  • Many times the pairs of letters are written broken into two letter groups for encoding and decoding.
    • This made it easy to determine that it was a playfair cipher so occasionally they would remove all spaces.

  • Example: TH EP LA YF AI RC IF ER or THEPLAYFAIRCIPHER

4 of 29

About Playfair Ciphers:

  • This type of cipher uses a table where one letter of the alphabet is omitted, and the remaining letters are arranged into a 5x5 grid.
    • One letter is omitted to reduce the alphabet to fit into the 5x5 grid.
    • You can either omit "Q" or the "J" .
      • Typically, the J is removed from the alphabet and an “I” takes its place in the text that is to be encoded.
      • This gives it a slightly more thought provoking nature as one has to think about converting the “J” to “I” and back again for decoding.

5 of 29

About Playfair Ciphers:

  • This type of cipher also uses a keycode.
    • A secret word or phrase that is used in creating the table grid.
    • Without the keycode, one can not decode messages since the grid is made based on the keycode.

http://www.publicdomainpictures.net/hledej.php?hleda=key

6 of 29

The Playfair Cipher in National Treasure:

https://www.youtube.com/watch?v=y0YvaorWqP8

7 of 29

About Playfair Cipher Grid Tables:

  • To generate the table,
    • first fill in the spaces of the table with the letters of the keyword
      • (dropping any duplicate letters),
    • then fill the remaining spaces with the rest of the letters of the alphabet in order
  • Example: If the Keycode is “SHAWN”, the table grid would look like the one to the right.

S

H

A

W

N

B

C

D

E

F

G

I

K

L

M

O

P

Q

R

T

U

V

X

Y

Z

8 of 29

About Playfair Cipher Grid Tables:

  • The Keycode is “SHAWN”
  • Notice, starting at the top left corner, we list the letters SHAWN.
  • We then follow with the remaining letters of the alphabet reducing by one letter.
    • In this one, the J is left out.
    • Remember, we could also remove the Q instead of the J.
    • Also note that the letters of the keycode are already used so they are not listed again later in the table grid.

S

H

A

W

N

B

C

D

E

F

G

I

K

L

M

O

P

Q

R

T

U

V

X

Y

Z

9 of 29

About Playfair Cipher Grid Tables:

  • If the keycode is longer than 5 letters, you just continue the letters on the following row.
  • If the keycode has a double letter or a letter that is used more than once, we skip the letter the second time it would appear.
  • Example: If the Keycode is “MARIANNE” it would appear as the grid to the right.

M

A

R

I

N

E

B

C

D

F

G

H

J

K

L

O

P

S

T

U

V

W

X

Y

Z

10 of 29

About Playfair Cipher Grid Tables:

  • Example: If the Keycode is “MARIANNE”
  • Notice that the keycode was longer than 5 letters and had to drop to the next line to complete the word.
  • Notice also that the second “A” and the second “N” is omitted in the keyword.
  • One other mention is that one can see that this time the “Q” was omitted instead of the “J”.

M

A

R

I

N

E

B

C

D

F

G

H

J

K

L

O

P

S

T

U

V

W

X

Y

Z

11 of 29

How to Encode a Message:

  1. Break the code into two-letter chunks.
  2. Repeated letters in the same chunk are usually separated by an “X”. The message, "HELLO HUNTER" would become "HE LX LO HU NT ER".
  3. If there is not an even number of letters in the message, it is padded with a spare X at the end.
    1. HELLO DECODER would become “HE LX LO DE CO DE RX”.

12 of 29

How to Encode a Message:

4. Next, you take your letter pairs and look at their positions in the grid.

    • If the letters appear on the same row of your table, replace them with the letters to their immediate right, wrapping around to the left side of the row if necessary. For example, using the table above, the letter pair IM would be encoded KG

13 of 29

How to Encode a Message:

4.

b. If the letters appear on the same column of your table, replace them with the letters immediately below, wrapping around to the top if necessary. For example, using the table above, the letter pair ER would be encoded as LY.

14 of 29

How to Encode a Message:

4.

c. If the letters are on different rows and columns, replace them with the letters on the same row respectively but at the other pair of corners of the rectangle defined by the original pair. The order is important - the first letter of the pair should be replaced first. For example, using the table above, the letter pair CR would be encoded as EP.

15 of 29

The Playfair Cipher in National Treasure:

https://www.youtube.com/watch?v=7tNEph7L0dU

16 of 29

How to Decode a Message:

  1. Draw a 5 x 5 table grid.
  2. Fill in the grid with the keycode and complete the grid.
    1. First fill in the spaces of the table with the letters of the keyword (dropping any duplicate letters), then fill the remaining spaces with the rest of the letters of the alphabet in order.
    2. Remember: One letter is omitted to reduce the alphabet to fit into the 5x5 grid. You can either omit "Q" or the "J".
      1. Hopefully you know which the encoder used. If not, pick one. If your decoding creates gibberish, then you may need to do it the other way later. You will find out.

17 of 29

How to Decode a Message:

3. Break the code into two-letter chunks if it is not. Remember sometimes to make it not look like a playfair cipher, people would remove all the spaces.

PNFCHDTSNONQGPAZ

PN FC HD TS NO NQ GP AZ

18 of 29

How to Decode a Message:

4. Next, you take your letter pairs and look at their positions in the grid.

    • If the letters appear on the same row of your table, replace them with the letters to their immediate left, wrapping around to the right side of the row if necessary. For example, using the table above, the letter pair KG would be decoded IM

19 of 29

How to Decode a Message:

4.

b. If the letters appear on the same column of your table, replace them with the letters immediately above, wrapping around to the bottom if necessary. For example, using the table above, the letter pair LY would be decoded as ER.

20 of 29

How to Decode a Message:

4.

c. If the letters are on different rows and columns, replace them with the letters on the same row respectively but at the other pair of corners of the rectangle defined by the original pair. The order is important - the first letter of the pair should be replaced first. For example, using the table above, the letter pair EP would be decoded as CR.

21 of 29

Let us practice:

PN FC HD TS NO NQ GP AZ

TH

EB

AC

ON

ST

AT

IO

NX

Removing the appropriate spaces you get:

THE BACON STATION

S

H

A

W

N

B

C

D

E

F

G

I

K

L

M

O

P

Q

R

T

U

V

X

Y

Z

22 of 29

President Kennedy?

On August 2, 1943 President J. F. Kennedy, Jr. used a Playfair cipher to alert others of where the PT boat under his command was lost in a military conflict with the Japanese destroyer Amagiri which had rammed and sliced in half the American patrol boat (PT-109.)

Lt. (jg) John F. Kennedy aboard the PT-109 in the South Pacific, 1943. Public Domain https://www.jfklibrary.org/Asset-Viewer/6uFr51bTGkStW-CCqCVdvw.aspx

Lt. (jg) John F. Kennedy aboard the PT-109 in the South Pacific, 1943. Public Domain https://www.jfklibrary.org/Asset-Viewer/cYgtxzfq4ESRTmpibzkyJw.aspx

23 of 29

President Kennedy?

  • Australian Coastwatcher Lieutenant Arthur Reginald Evans of the Royal Australian Naval Volunteer Reserve received the following message at 0930 on the morning of the 2 of August 1943 via Morse Code:

KXJEY UREBE ZWEHE WRYTU HEYFS �KREHE GOYFI WTTTU OLKSY CAJPO �BOTEI ZONTX BYBWT GONEY CUZWR �GDSON SXBOU YWRHE BAAHY USEDQ

  • Evans, often having used the Playfair system, deciphered it with the key ROYAL NEW ZEALAND NAVY
  • Kennedy and his crew were later rescued by Evans himself. Kennedy became a war hero and later becomes a U.S.President. Evans eventually visited the Whitehouse.

24 of 29

Would you have saved Kennedy and his crew? Try to solve the cipher he sent:

First make your grid using the key

ROYAL NEW ZEALAND NAVY.

Hint: His cipher removed the J.

Can you make your grid correctly?

R

O

Y

A

L

N

E

W

Z

D

V

B

C

F

G

H

I

K

M

P

Q

S

T

U

X

25 of 29

Would you have saved Kennedy and his crew? Try to solve the cipher he sent:

The Kennedy Cipher split into two letter pairs:

KX JE YU RE BE ZW EH EW RY TU HE YF SK RE HE GO YF I W TT TU OL KS YC AJ PO BO TE IZ ON TX BY BW TG ON EY CU ZW RG DS ON SX BO UY WR HE BA AH YU SE DQ

R

O

Y

A

L

N

E

W

Z

D

V

B

C

F

G

H

I

K

M

P

Q

S

T

U

X

26 of 29

Would you have saved Kennedy and his crew? Try to solve the cipher he sent:

Translated one letter pair at a time:

PT BO AT ON EO WE NI NE LO ST IN AC TI ON IN BL AC KE TT ST RA IT TW OM IL �ES SW ME RE SU CO CE XC RE WO FT WE LV EX RE QU ES TA NY IN FO RM AT IO NX

R

O

Y

A

L

N

E

W

Z

D

V

B

C

F

G

H

I

K

M

P

Q

S

T

U

X

*Note: there is a double TT that did not get translated. We can not do that in a Playfair Cipher. Some believe Kennedy did this to make people believe this was not a Playfair Cipher others think it is just a mistake he made.

27 of 29

Would you have saved Kennedy and his crew? Try to solve the cipher he sent:

Combine the pairs and complete the translation:

PT BOAT ONE OWE NINE LOST IN ACTION IN BLACKETT STRAIT TWO MILES SW MERESU COCE X CREW OF TWELVE X REQUEST ANY IN FORMATION X

R

O

Y

A

L

N

E

W

Z

D

V

B

C

F

G

H

I

K

M

P

Q

S

T

U

X

**Note: COCE is misspelled. It is interpreted to supposedly mean COVE.

28 of 29

President Kennedy?

So did you get the translation to save Kennedy and his crew? Evans did!

Evans’ translation:

PT BOAT ONE OWE NINE LOST IN ACTION IN BLACKETT STRAIT TWO MILES SW MERESU COVE X CREW OF TWELVE X REQUEST ANY INFORMATION.

29 of 29

Are you ready to encode and decode?

Of course you are!