CoursesAIMathCodePhysicsAbout and FAQ

TwiddleLab / Code / How Computers Store Everything

Secret Messages

Lesson 10 of 11 · 7 min · Free, no account needed

What you will learn

  • Encryption turns a message into gibberish that only someone with the key can undo.
  • The Caesar cipher moves every letter the same number of places. There are only 25 keys.
  • Frequency analysis: E is the most common letter in English, even in disguise, so the key shows itself.
  • Strong ciphers use huge keys and hide letter patterns.

Start the lesson

How the lesson goes

  1. Your little brother reads your diary. Can you write so only your best friend can read it?

    Tap the lines and see what he can read.

  2. Your friend has a cipher wheel. Turn it until KHOOR becomes a word.

    Drag the inner ring, or use the slider or arrow keys.

  3. Write your own secret.

    Type a short message, then pick a key on the wheel.

  4. Encryption.

    Encryption turns a message into a secret text; decryption turns it back.

    The key is the secret part. In the Caesar cipher the key is how far each letter moves.

    A key of 26 brings every letter back to itself, so there are only 25 useful keys.

  5. A code breaking machine attacks your secret.

    It tries every key. Press Stop when it hits your message.

  6. A smarter attack: count the letters.

    Slide the violet bars of the secret until they match the shape of English.

  7. How common is E really?

    This is the start of a famous novel. Estimate, like in statistics: what share of its letters are e?

  8. Beat the clock: crack three intercepted messages.

    Tap the bar you think is E. Faster means more points.

  9. Which secrets could a computer crack quickly?

    Think: how many keys, and does the letter pattern still show?

  10. Send your secret to your best friend.

    Two readers, one note. Give the key to only one of them.

Previous lesson: Fixing Errors on the Fly · Next lesson: Hide a Message in a Picture · Part of the course: How Computers Store Everything

Lessons are interactive and need JavaScript. Turn it on to play them.

Loading TwiddleLab