Encryption Basics

BeginnerAbout 12 minCybersecurity

Put a note in a box, lock it, and send it anywhere. Anyone can carry the box — but only someone with the right key can read what's inside.

The Locked Box

When you send a message over the internet, it passes through lots of computers you don't own and people you'll never meet. It's a bit like handing a postcard to a chain of strangers — any of them could read it.

Encryption puts the message in a locked box first. The strangers can still pass the box along, but without the key, all they see is scrambled nonsense.

The Error Correction page is about protecting data from accidental damage. Encryption is about protecting it from unwanted eyes.

The Words You'll Hear

PlaintextThe original, readable message.
CiphertextThe scrambled version that looks like nonsense.
KeyThe secret that tells you how to scramble and unscramble.
EncryptLock it: turn plaintext into ciphertext.
DecryptUnlock it: turn ciphertext back into plaintext.

A 2,000-Year-Old Lock

One of the oldest known ciphers is named after Julius Caesar, who is said to have used it for military messages. You move every letter a set number of places along the alphabet. With a key of 3, A becomes D, B becomes E, and so on:

HELLOKHOOR

To decrypt, you move each letter back by the same amount. The key — "3" — is the secret.

Try it yourself

3

Result

Why Caesar's Lock Is Weak

The Caesar cipher only has 25 possible keys. Anyone who intercepts the message can simply try all of them — which is exactly what the "Crack it" button does. A computer can do that faster than you can blink.

That's the heart of good encryption: there must be so many possible keys that trying them all is hopeless.

Modern Keys Are Made of Bits

Today's encryption keys are long binary numbers. As you've seen elsewhere on this site, every extra bit doubles the number of possibilities. A common key size is 128 bits, which gives:

2128 ≈ 340,000,000,000,000,000,000,000,000,000,000,000,000 keys

That's the same enormous number as the count of IPv6 addresses. Even if every computer on Earth tried billions of keys a second, working through them all would take far, far longer than the universe has existed.

The Problem With Sharing Keys

Caesar's cipher, and many modern ones, use the same key to lock and unlock. That's called symmetric encryption. It's fast and strong — but it has a problem: before you can send a secret message, your friend needs a copy of the key. How do you get it to them without someone copying it on the way?

The clever solution uses two different keys — one for locking, one for unlocking.

Read nextPublic-Key Cryptography →

Where Encryption Protects You

  • The padlock icon next to a web address means your connection to that site is encrypted.
  • Secure messaging apps encrypt messages so only the people in the chat can read them.
  • Your phone encrypts what's stored on it, so a stolen phone doesn't mean stolen photos.
  • Wi-Fi networks with a password encrypt the data travelling through the air.