# Secret Codes #7

In *National Treasure: Book of Secrets*, Nicolas Cage is again embroiled in codes and puzzles that turn his life upside down. The movie opens with a frantic attempt to decode a Playfair cipher, another substitution cipher in the same general family as Caesar and Vigenère -- letters are substituted for others, not just rearranged like the railfence cipher in Secret Codes #5.

Using a Playfair cipher (named after Lord Playfair who didn't invent it!) has a few more rules than the ciphers we've seen so far.

The key is written inside a 5x5 cube, one letter in each square and then the rest of the alphabet fills out the rest of the cube in order. Usually "I" and "J" share the same space. No letters are repeated.

Let's say the key is "GRAPEFRUIT". The cube used to encipher and decipher will look like this:

Notice there is no second "R" in "GRAPEFRUIT" because no letters are repeated and "J" is not listed because "I" is already there. This fits the English alphabet into a 5x5 matrix.

Now down to business. We want to encipher the message "The key is inside the old clock".

First we break down the plaintext into digraphs (groups of 2 letters) adding an X if we need to break up 2 of the same letters in a row or finish a group of 2 letters:

TH EK EY IS IN SI DE TH EO LD CL OC KX

By comparing the letters in each digraph, we get the ciphertext. If the 2 letters of a digraph are in the same column, each letter substitutes for the letter below it. If the 2 letters are in the same row, each letter substitutes for the letter to the right of it. If the letters are diagonal and form a rectangle or square, letters substitute for the letters in the same row in the corner. Let's take a look at an example:

"T" and "H" form a square in the cube so get enciphered to "I" and "K" -- the opposite sides of the square. The same with "E" and "K" which become "P" and "L" and so on.

The final ciphertext for our example is IK PL PZ BO UO OB LR IK AS CH DC MH HY

To decipher a message using the key, build the cube (carefully!) and then reverse the process for each digraph.

This badge has been awarded to 105 players

Sign in to see your progress on this badge

**Game**

WinterGame2021

**Difficulty**

★★☆☆
2 of out 4 difficulty

**Badge Points**

100