BrightKidz Library
Subjects
The same letter counts before and after an alphabet is scrambled Two rows of bars, one on each side of an arrow. Each bar is how often one letter is used. On the left is an ordinary message, where one bar stands far taller than the rest because one letter is used much more than any other. On the right is the same message written in a scrambled code. The bars are exactly the same heights, only shuffled into a different order, and the very tall bar is still there. Scrambling changes which letter is which, and changes nothing at all about how often each is used.

Why a Scrambled Alphabet Is Not Safe

About 15 minutes

At the end you were told how to make a harder code: instead of shifting every letter along by three, scramble the whole alphabet. A becomes Q, B becomes F, C becomes M, in no order at all.

That really is harder. It is enormously harder in the one way people usually measure, and it is worth seeing just how enormously before finding out that it does not help.

Count the keys

With a shift code, the key is a single number. Shift by 1, or 2, or up to 25 — and shifting by 26 puts everything back where it started. Twenty-five keys. A patient person tries them all in a few minutes.

Now count the scrambled ones. Pick any of the 26 letters to stand for A. That leaves 25 to choose from for B, then 24 for C, and so on down to the last letter, which has no choice left at all.

Multiply all of that together and you get a number twenty-seven digits long.

Here is what a number that size means. Suppose you could test a million keys every second — not a person, a machine, a million every second without stopping. Run it from the day you were born to the day you are very old, and you would not have got through a billionth of them.

So it is safe. That is the obvious conclusion and it is wrong, and the reason it is wrong is the best thing on this page.

Nobody is going to try the keys

A scrambled alphabet is not broken by hunting through keys. It is broken by counting letters, and the counting takes an afternoon.

Here is the leak. Scrambling changes which letter is which. It does not change how often each one is used.

In English writing, the letter E turns up more than any other, and not by a little. Every message you have ever written is full of them. When you scramble the alphabet, every one of those Es becomes some other letter — but they all become the same other letter, and it appears in the coded message exactly as often as the E did in yours.

So the commonest letter in the code is almost certainly E. You did not try a key. You just counted, and the code told you.

Watch one come apart

Somebody hands you this and no key at all.

VQQZ VQ KQJQ PKQX ZKQ DQCC JFXNY
A scrambled-alphabet message being read without its key A coded message on the top row and the real message building up underneath it, one stage at a time. First the most common coded letter is found and read as E. Then a three-letter word ending in that E is read as THE, which gives two more letters. Each letter recovered gives away the next, and the whole message comes out without anybody ever trying a key. V Q Q Z V Q K Q J Q P K Q X Z K Q D Q C C J F X N Y the letter used most . E E . . E . E . E . . E . . . E . E . . . . . . . 1 letters known . E E T . E H E . E . H E . T H E . E . . . . . . . 3 letters known M E E T M E H E R E W H E N T H E . E . . R . N . . 7 letters known M E E T M E H E R E W H E N T H E B E L L R I N G S 12 letters known

Follow it letter by letter. Nothing here is a guess at the key.

  1. Count. Q appears eight times, and nothing else comes close — the next best manages three. In a message this short that is a very loud signal.
  2. Read every Q as E. Suddenly you can see word shapes: a four-letter word starting with two Es in the middle, a four-letter word that is E-something-E-something.
  3. Look at ZKQ. Three letters, ending in E, standing on its own. The commonest three-letter word in English is THE, so Z is T and K is H. Two more letters, for free, and you have still not tried a key.
  4. Now KQJQ reads HE_E, which can only really be HERE, so J is R. VQQZ reads _EET and VQ reads _E, and MEET and ME fit both at once, so V is M. PKQX is _HE_ — WHEN. Every letter you win hands you the next.
  5. DQCC is _E__ with a doubled letter at the end: BELL. JFXNY starts R and has an N: RINGS. The message is MEET ME HERE WHEN THE BELL RINGS, and the key was never needed.

Notice what did the work. The doubled letters stayed doubled. The short words stayed short. The gaps between words stayed where they were. None of that is hidden by swapping letter names, and all of it is a way in.

The thing worth keeping

A code is not strong because it has a lot of keys.

The shift code and the scrambled code have wildly different numbers of keys — twenty-five against a twenty-seven-digit number — and they lose to the same attack, because they leak the same thing. In both, one letter of your message always turns into the same letter of the code. Every time. That single habit is what the counting feeds on, and no amount of extra keys removes it.

Ask a different question about a code, and it is a much better question: does the coded message give anything away about the real one? If the answer is yes, the number of keys is decoration.

Two codes are being compared. Why does the one with a twenty-seven-digit number of keys fall just as fast as the one with twenty-five?

Make yours actually harder

The weakness is that one letter always becomes the same letter. So change the key as you go.

Agree a short word with your friend — say CAT — and write it over and over above your message. Shift each letter by a different amount depending on the letter above it: C shifts by 3, A by 1, T by 20. Now the Es in your message stop all turning into the same letter, and the tall bar in the counting flattens right out.

That one change is the difference between a code somebody unpicks over a wet afternoon and a code that held up for centuries.

One last thing to try on a friend

Give somebody a scrambled-alphabet message and tell them, honestly, how many keys there are. Watch them decide it is hopeless.

Then hand them a pencil and tell them to count the letters instead.