Wirebook

Wirebook › Lesson 4 of 18

Secret codes: encryption and hashing

About 7 minutes · hands-on · nothing you type leaves your browser unless a button says so

Every time you see the padlock, your messages are being scrambled so that only the right computer can unscramble them. Let's play with the two big ideas behind that: encryption (lock and unlock) and hashing (a fingerprint that can't be reversed).

1. A 2,000-year-old secret code

Julius Caesar is said to have shifted every letter along the alphabet. With a shift of 3, A becomes D and B becomes E.

Crack it! See all 26 possible shifts

    The weakness: there are only 25 possible keys, so anyone can just try them all (look above and you'll spot your message straight away). Real encryption has more possible keys than there are atoms in the universe... several times over.

    2. Real encryption, right in your browser

    This uses AES-256, the same lock banks use. Your browser makes a brand-new random key each time. Nothing leaves this page.

    Press "Lock" twice with the same message: the scrambled result is completely different every time, because each lock uses a fresh random key and a random starting value.

    3. Fingerprints: hashing

    A hash turns any text into a fixed-length fingerprint. The same text always gives the same fingerprint, but change one letter and the whole thing changes. And you can't turn a fingerprint back into the text.

    Where you meet these every day

    Words from this lesson

    Earn your stamp

    Get all 3 right to collect the Locks & fingerprints stamp. Wrong answers are fine: just try again.

    1. Why is Caesar's cipher easy to crack?

    2. Can you turn a hash back into the original text?

    3. How should a good website store your password?

    Try another lesson

    1. 5What do 404 and friends mean?5 min · interactive
    2. 6How does a message cross the world in a blink?7 min · interactive
    3. 7Why does Wi-Fi get weaker through walls?7 min · interactive