Encryption
Turning Secrets Into Nonsense
Every message you send crosses networks you do not control — routers, cables, towers owned by strangers. Without protection, anyone along that path could simply read it. Encryption is the answer: mathematically scrambling data so that, without the right secret, it is meaningless — while remaining perfectly readable to whoever holds that secret.
The vocabulary: readable original data is plaintext; the scrambled result is ciphertext. Encrypting turns plaintext into ciphertext; decrypting reverses it — but only with the correct key, the secret value controlling exactly how the scrambling happened.
A Toy Cipher, and Why It Fails
The simplest encryption is a shift cipher: replace each letter with one a fixed number of places along the alphabet. Shift by 3: A→D, B→E, HELLO→KHOOR.
It is genuinely encryption — plaintext, ciphertext, a key (the shift amount), reversible only if you know it. But it collapses under real scrutiny. English text has a fingerprint: E is the most common letter, then T, then A… Shift the whole alphabet and the fingerprint survives, just shifted. Count letter frequencies in enough ciphertext, spot the tell-tale pattern, and the shift amount falls out in minutes — a technique called frequency analysis, centuries old. This is the same lesson as comparing algorithms: something that "looks secure" and something that withstands attack are very different claims, and only the second one counts.
Modern Encryption: Trust the Maths, Not the Secrecy
Real encryption learned this lesson thoroughly. Rather than hiding the method, modern systems publish their algorithms openly, invite the world's cryptographers to attack them for years, and rely entirely on the key staying secret. This principle has a name — Kerckhoffs's principle — and a very practical reason: an algorithm nobody has scrutinised might have flaws nobody has found yet; one thousands of experts have failed to break for decades is a much safer bet. If a key is ever compromised, you simply issue a new one — you cannot as easily invent a new, unbroken algorithm overnight.
The scrambling itself is genuine mathematics — far beyond a letter shift, working on the binary representation of data with keys of enormous length, making guessing the key computationally hopeless (billions of years of guessing, even with powerful computers) without breaking the maths itself.
Where You Meet It Every Day
- HTTPS — that padlock in your browser encrypts everything between you and a website: passwords, messages, payment details, invisible to anyone intercepting the network traffic along the way. Its absence is a real warning, discussed in online safety.
- End-to-end encrypted messaging — some apps encrypt on your device and decrypt only on the recipient's, meaning not even the company running the servers in between can read the content
- Wi-Fi security (WPA) — your home router encrypts traffic over the air, so a neighbour cannot simply listen in on your radio waves
- Device encryption — modern phones encrypt their entire storage, so a stolen phone's data stays locked without the passcode
Why Encryption Matters Beyond Secrecy
Encryption isn't just about hiding gossip — it underpins trust in systems society depends on: online banking, medical records, government services, private conversations, journalism sources, and business secrets. It is also, deliberately, a double-edged tool: the same maths protecting your messages from criminals also protects criminals' messages from investigators, which is why encryption policy is a genuine, ongoing ethical and legal debate — not a settled technical footnote.
Try It Yourself
Encrypt a short message with a shift-of-5 cipher, then swap with a partner and try to crack each other's without knowing the shift (there are only 25 possible shifts — try them all, or use letter frequency). Notice how fast a "secret" collapses once you know the method is weak — and contrast that with why real systems bet everything on a secret key instead.
Worked Example — Cracking a Shift Cipher With Frequency Analysis
To see exactly why shift ciphers fail, crack one properly using the technique described earlier in this lesson. Here is a short piece of ciphertext: WKH VHFUHW LV VDIH — and here is the letter-frequency count: H appears 4 times, more than any other letter.
In ordinary English, the single most common letter is E. If H is standing in for E, that suggests a shift of 3 (E→H is three letters along the alphabet: E, F, G, H). Testing that shift on the whole message — shifting every letter back by 3 — gives: THE SECRET IS SAFE. Cracked, using nothing but a frequency count and one reasonable guess, without ever being told the key.
This worked example demonstrates precisely why Kerckhoffs's principle exists: the "secret" in a shift cipher isn't really secret at all — it leaks through the statistical fingerprint of the language itself, the same fingerprint every piece of English text carries. Real encryption systems are deliberately designed so that even huge amounts of intercepted ciphertext reveal no statistical pattern at all — which is exactly the property a shift cipher, however long the message, can never achieve.
Key Words
- Encryption / decryption — scrambling plaintext into ciphertext, and reversing it
- Plaintext / ciphertext — the original readable data / the scrambled result
- Key — the secret value controlling the scrambling; what must stay protected
- Frequency analysis — cracking simple ciphers by counting letter patterns
- End-to-end encryption — encrypted for the whole journey, unreadable even to the service provider