Star Student Builder logoStar Student Builder
← Young Researchers TechnologyCiphers and frequency analysis40 minutesStd 9–12

Break a Secret Code

✨ One bar chart of letter counts hands you your friend's secret key without a single guess at the message.

Two sliding alphabet strips showing every letter shifted forward by four, beside a bar chart of letter frequencies in the intercepted message where the tallest bar is I, which must be E, revealing the key.
How it works

🧰 You need

  • two strips of card to make a cipher wheel
  • paper and pencil
  • a passage of about 200 letters you have written yourself
  • a calculator
  • a friend to exchange messages with

πŸ‘€ What you will see

The letter counts are strongly uneven, with a few tall bars and many near zero. Matching the tallest bar to E usually gives the correct shift on the first or second attempt. A short message gives a flatter, less reliable chart.

πŸ§ͺ Do it

  1. Write the alphabet twice around two card strips so one can slide against the other to give a shift.
  2. Choose a secret shift between 1 and 25 and encrypt your 200-letter message with it.
  3. Swap encrypted messages with your friend without revealing either key.
  4. Tally how often each letter appears in the message you received, and convert the counts to percentages.
  5. Draw a bar chart of the percentages and identify the tallest bars.
  6. Assume the tallest bar is E, work out the shift that this implies, and decrypt the first line to test it.
  7. If the first line is nonsense, try the next tallest bar as E and test again.

πŸ’‘ Why it happens

A Caesar cipher shifts every letter by the same amount, so there are only 25 possible keys and the whole pattern of letter frequencies simply slides along. In English, E, T and A are the most common letters, appearing in roughly 12, 9 and 8 per cent of text, so the tallest bar in a long enough message is very likely to be E. Comparing a measured frequency chart with known language frequencies is called frequency analysis, and it is why a single fixed shift is hopeless for real secrecy. Modern encryption defeats it by making every occurrence of a letter encrypt differently, so the output frequencies come out nearly flat.

πŸ” Now try this

Encrypt a 30-letter message with the same method and test whether frequency analysis still finds the shift.

πŸ€” Think about it

What kind of message would defeat frequency analysis even with a simple shift cipher?

🧘 Ask the Acharya

β€œWhat kind of message would defeat frequency analysis even with a simple shift cipher?” β€” ask him and he will explain it from your own chapters.

Ask Guru β†’

More for Std 9–12

Ask GuruAcharya Samayeshwar