# Strategy for finding the key to this cipher

A coworker and I are perplexed over this puzzle. We gave up and looked at the answer, but we cannot seem to understand how it works. Can anybody explain?

### Text version of the above image

We've created a simple code by taking a 13-letter phrase with no repeated letters and writing the remaining 13 letters of the alphabet in order under it. For example:

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


Letters are encoded by vertical substitution, so GROVEL encodes as BQEWOH. The three words below are encoded using a different base phrase. Can you deduce the phrase?

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

• Welcome to Puzzling.SE! I can't see your puzzle. :( Can you reupload the image through the stack exchange imgur (you can do it on the edit screen with the little button that looks like a landscape)? – Bailey M Sep 1 '15 at 20:59
• @BaileyM I suspect your problem is the size of the image (3246x2448). This could make problems on devices like phones. – Sleafar Sep 1 '15 at 21:06
• you could start by listing out all of the known characters (with pair underneath) and look for the ones whose partner is out of order alphabetically. this would give you a list of candidates to look for a 13 letter phrase with. – Kingrames Sep 1 '15 at 21:17

I'm not sure if you don't understand the example puzzle, or if you don't understand how to find the solution. I'll explain both, just in case.

The example takes a word/phrase that is 13 letters long with no repeated letters. That means it contains exactly half of the letters in the alphabet (26 total). Then the 13 remaining letters are written below, in alphabetical order.

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


To encrypt a word/phrase (like GROVEL in the example), find the first letter in your grid, and take the letter directly above/below it. G is below B, so our first encrypted letter is B. Next is R. It is above Q, so the next encrypted letter is Q.

Continuing in this way, we encrypt GROVEL as BQEWOH.

The puzzle creators have done the same thing with a different 13-letter phrase, and then have encrypted 3 words with it: BOXCAR, JOKILY, and QUARTZ. They show you the encrypted version of these three words, and they want you to work backwards and find the 13-letter phrase they used to create their grid.

The key to solving this is to realize that the letters at the end of the alphabet are not very common, so many of them will not be included in most 13-letter phrases. That means they would be used to "fill in" the bottom row of the grid, which means they would remain in alphabetical order (much like W X Y Z in the given example).

We start constructing our grid from the bottom right. According to the example words given, Z matches with S, Y with E, X with P, and W with A.

If we write this into our grid, we have

. . . . . . . . . A P E S
. . . . . . . . . W X Y Z


That looks promising! The letters on the top look like they could be part of a common English word or phrase! Let's keep going.

. . . . . . G I R A P E S
. . . . . . T U V W X Y Z


This still looks promising. We need to skip S, R, and P, because they are already accounted for in the grid. A few more:

. . . J M F G I R A P E S
. . . N O Q T U V W X Y Z


This doesn't look too good! There is no English word with JMFG in it! But wait; N and O are way more common letters than J and M, so they're more likely to be in the original phrase. What if we swap those around, so N and O are on the top? Then the letters on the bottom are still in alphabetical order, as required, but we have something a little more sensible:

. . . N O F G I R A P E S
. . . J M Q T U V W X Y Z


Now I'm starting to see a pattern. Maybe the I/U pair doesn't belong there. We can flip it over and insert it at the appropriate point (to keep the bottom row in alphabetical order):

. . . U N O F G R A P E S
. . . I J M Q T V W X Y Z


Now there are only 3 letter pairs unaccounted-for: B/D, C/K, and H/L

There aren't that many ways they can be added, since we need to keep everything on the bottom row in alphabetical order, so a little trial and error (or guessing at the phrase) yields:

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


Thus the solution is BUNCH OF GRAPES.

• +1 for including an explanation of the puzzle. I was thinking something completely different. – Tracy Cramer Sep 2 '15 at 2:14

The coding phrase is:

BUNCHOFGRAPES

The resulting codex is:

Found by:

Writing out the alphabet in order with it's coded letter beneath, looking for partial phrases - GRAPES jumped out:

• Wow, solved quicker than it took for me to formulate a strategy. that's impressive. – Kingrames Sep 1 '15 at 21:18
• I'd be interested to know if there's a more definitive way of solving it - or if it does come down solely to observation. – alexmc Sep 1 '15 at 21:20
• @alexmc The key phrase will always be in your bottom row, in order. It's just a matter of eliminating the irrelevant letters. You got lucky in that many of the relevant ones were grouped together, making it easier. – GentlePurpleRain Sep 1 '15 at 22:00

Another method of solving:

Take the list of letter frequencies in English (usually something like ETAOIN SHRDLU CMFWYP VBGKQJ XZ from most frequent to least, although it varies a little).

Assume that your key phrase will be made up mostly of common letters.

For each letter pair, arrange it so that the more-common letter is on the top:

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


Arrange the bottom row into alphabetical order (keeping the pairs together, of course):

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


If it isn't already obvious what needs to be switched around, look for letter pairs that are relatively close to each other in the frequency list, or those that contain 2 letters nearer the beginning of the list, and try swapping them, rearranging the bottom as necessary to keep things in alphabetical order.

It won't take long to arrive at

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


I know I'm late to the game but here's my solution.

I took the programming route and created an application to help me solve it. Since the algorithm to solve it has pretty much been discussed, I'll skip over that.

First, I created a series of buttons like so :

A <=> W
B <=> D
...
S <=> Z


Then I created labels for each letter in the place of where it's partner would go alphabetically, like this:

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


Next, I set the buttons to toggle between the two choices, e.g. if I clicked on A, W would disappear and A would become visible and vice versa.

Finally, I ran the app and went down the list of buttons and selected the one that is more common. That got me this:

D    T L  N C  O    F    I R A P E S


From there, it quickly became obvious after a few logical swaps that the answer is

BUNCHOFGRAPES