# 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. If you are at the end of a column or row, and need the letter below or to the right, wrap around and take the first letter in the column or row. 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 265 players

Sign in to see clues and check your progress on this badge

**Game**

SummerGame2021

**Difficulty**

★★☆☆
2 of out 4 difficulty

**Badge Points**

100

## Comments

## The description of the…

The description of the cypher says, "If the 2 letters are in the same row, each letter substitutes for the letter to the right of it." And then in the example, LD encodes into CH.

English is unclear about which way to interpret the words "substitutes for," but, with either interpretation, I am not able to explain how LD becomes CH.

The row of the key that has those letters says: C D H K L

C and H are both next to D, and neither is next to L, not even if you wrap around on the end.

Please, what am I missing about how the example works?

## Oh!!! It *is* wraparound! L…

Oh!!! It *is* wraparound! L becomes the letter to its right, wrapping around to C. And D becomes the letter to its right, H.

I spent a long time staring at that, but I am all set now!

## Sorry for the confusion! I…

Sorry for the confusion! I have added some text to make it clearer. In any case, I'm glad you got it solved!