NOVA Online (click here for NOVA home)
Decoding Nazi Secrets
Site Map

The Playfair Cipher
Back to Crack the Ciphers

In 1854, Sir Charles Wheatstone invented the cipher known as "Playfair," named for his friend Lyon Playfair, first Baron Playfair of St. Andrews, who popularized and promoted the cipher. Its simplicity and its cryptographic strength compared to simple substitution and Vigènere (a polyalphabetic substitution cipher) made it an immediate success as a field cipher, used by the British in the Boer War and the First World War, and by several armed forces as an emergency back-up cipher in the Second World War. When Lt. John F. Kennedy's PT-109 was sunk by a Japanese cruiser in the Solomon Islands, for instance, he made it to shore on Japanese-controlled Plum Pudding Island and was able to send an emergency message in Playfair from an A llied coast-watcher's hut to arrange the rescue of the survivors from his crew.

To encipher a message in Playfair, pick a keyword and write it into a five-by-five square, omitting repeated letters and combining I and J in one cell. In this example, we use the keyword MANCHESTER and write it into the square by rows. It may be written in any other pattern; other popular choices include writing it by columns or writing it in a spiral starting at one corner and ending in the center. Follow the keyword with the rest of the alphabet's letters in alphabetical order.

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


First we need to prepare the plaintext message for encryption. To encrypt "THIS SECRET MESSAGE IS ENCRYPTED," break it up into two-letter groups. If both letters in a pair are the same, insert an X between them. If there is only one letter in the last group, add an X to it.

	TH IS SE CR ET ME SX SA GE IS EN CR YP TE DX


Now we encrypt each two-letter group. Find the T and H in the square and locate the letters at opposite corners of the rectangle they form:

		.  .  N  .  H
		.  .  T  .  B
		.  .  .  .  .
		.  .  .  .  .
		.  .  .  .  .


Replace TH with those letters, starting with the letter on the same row as the first letter of the pair: TH becomes BN. Continue this process with each pair of letters:

	TH IS SE CR ET ME SX SA GE IS EN CR YP TE DX
	BN FR


Notice that S and E are in the same row. In this case we take

		.  .  .  .  .
		E  S  T  .  .
		.  .  .  .  .
		.  .  .  .  .
		.  .  .  .  .


the letter immediately to the right of each letter of the pair, so that SE becomes TS.

	TH IS SE CR ET ME SX SA GE IS EN CR YP TE DX
	BN FR TS


Now we see that C and R are in the same column. Use the letter

		.  .  .  C  .
		.  .  .  R  .
		.  .  . I/J .
		.  .  .  .  .
		.  .  .  .  .


immediately below each of these letters, so that CR becomes RI. This is the last special case, and the encryption proceeds without further incident.

	TH IS SE CR ET ME SX SA GE IS EN CR YP TE DX
	BN FR TS RI SR ED TW FS DT FR TM RI XQ RS GV


To decrypt the message, simply reverse the process: If the two letters are in different rows and columns, take the letters in the opposite corners of their rectangle. If they are in the same row, take the letters to the left. If they are in the same column, take the letters above each of them.

Playfair Hint #1
Back to Crack the Ciphers



Crack the Ciphers | Send a Coded Message | A Simple Cipher
Are Web Transactions Safe? | Mind of a Codebreaker | How the Enigma Works
Resources | Teacher's Guide | Transcript | Site Map | Decoding Nazi Secrets Home

Editor's Picks | Previous Sites | Join Us/E-mail | TV/Web Schedule
About NOVA | Teachers | Site Map | Shop | Jobs | Search | To print
PBS Online | NOVA Online | WGBH

© | Updated November 2000