Skip to content

Pattern Recognition in Encrypted Text

A cipher hides the letters, yet word lengths and repeated letters stay visible. This guide shows how to use them to solve a coded message by hand.

advertisement

What pattern recognition means

A substitution cipher replaces letters and leaves almost everything else alone. If the spaces are kept, you can still see how long each word is. If a letter repeats inside a word, its replacement repeats in the same place. Pattern recognition means using those leftovers to guess real words, then checking each guess against the rest of the text.

You barely need it for a Caesar cipher, since a brute force attack has only 25 shifts to try. It matters for a substitution cipher, where any letter can stand for any other and trying every key by hand is out of the question. It pairs well with frequency analysis: counting suggests which letters to try, and word shapes show whether they fit.

Worked example: a message solved step by step

Here is a short message under a substitution cipher, with the spaces kept. Each step below uses one clue. A question mark stands for a letter we do not know yet, and the highlighted letters are the ones that step adds.

ZIT STZZTK OL OF ZIT WGZZST

A short word repeats

One three-letter word appears twice. In English, THE is the best first guess, and it gives us three letters everywhere they appear.

THE ?ETTE? ?? ?? THE ??TT?E

A doubled letter

The second word now reads ?ETTE?. LETTER fits, so we try it and see whether the rest of the message still makes sense.

THE LETTER ?? ?? THE ??TTLE

The guess holds up

With L in place, the last word reads ??TTLE. BOTTLE fits the gap and suits a message about a letter.

THE LETTER ?? ?? THE BOTTLE

Two small words

Only ?? and ?? remain. They start with the same letter, and IS and IN are both common. The message reads THE LETTER IS IN THE BOTTLE.

THE LETTER IS IN THE BOTTLE

Start with the most common short words

A few short words turn up again and again. In a very large sample of English books, the alone makes up about 7% of all words.

Length Common words
1 letter a, I
2 letters of, to, in, is, it
3 letters the, and, for
4 letters that

A one-letter word is the strongest clue you can get, because in English it is almost always A or I.

A cipher keeps the shape of a word

Write the first letter of a word as A, the next new letter as B, and so on. LETTER becomes ABCCBD, and it keeps that shape under any substitution key. Here are three words with a shape worth knowing, next to one possible encrypted version:

Word Encrypted Shape
LETTER STZZTK ABCCBD
THAT ZIQZ ABCA
PEOPLE HTGHST ABCADB

Word parts help as well. English words often end in -ING, -ED or -LY, and in the same book sample THE, AND and ING are the most common three-letter sequences. If the same three cipher letters keep closing long words, try ING.

With a Caesar cipher, one word is enough

Under a Caesar cipher every letter moves by the same amount, so one recognised word gives you the shift for the whole message. Take this one:

WKH FLSKHU LV EURNHQ

The first word could be THE. If so, W stands for T, which is three places on, and H and K agree. Move every letter back by three and the message opens.

Show the message

THE CIPHER IS BROKEN

Practice on two messages

Try these with a pencil before you open the answers. Spaces are kept in both.

A Caesar cipher

AOL RLF PZ PU AOL IVE

A three-letter word appears twice. Work out its shift, then use the same shift everywhere.

Show the answer

THE KEY IS IN THE BOX

A substitution cipher

ULC BMU MDV ULC VSZ MOC KD ULC ZMOVCD

One word appears three times. After that, look for the other three-letter words.

Show the answer

THE CAT AND THE DOG ARE IN THE GARDEN

When patterns stop helping

Short messages may not contain a single repeated word, and names or technical terms can break the usual habits of a language. If the spaces have been removed or the text is split into equal groups, you have to find the word boundaries first.

A polyalphabetic cipher such as Vigenère turns one letter into different letters, which breaks word shapes, so you need its key length before these clues return. Modern encryption such as AES hides these patterns altogether, so nothing on this page will open an encrypted file or password. For more ways in, see breaking a cipher without the key.

Frequently asked questions

What is pattern recognition in cryptanalysis?

It means using what a cipher leaves visible, such as word lengths, repeated letters and common words, to guess parts of the message and test those guesses.

Which words should I try first in a cryptogram?

Try the most common short words of the language. In English, begin with THE and with A or I for one-letter words.

Does pattern recognition work on a Caesar cipher?

Yes, and one recognised word gives you the shift. Trying all 25 shifts is just as quick, though, so it matters more for substitution ciphers.

Can it break modern encryption?

No. Modern ciphers such as AES hide these patterns, so this method only works on classical ciphers and puzzles.

Sources

Keep going