🔏 How Encryption Works
Understand the math that keeps secrets safe. You'll grasp keys, public-key cryptography, and how encryption protects messages, payments, and the web without needing the equations.
What you’ll learn
- What Encryption Actually PromisesSeparate the three things people merge into 'encrypted', and establish Kerckhoffs's principle as the field's founding discipline.Encryption promises confidentiality — that a message is unreadable to anyone without the key — and by itself promises nothing else. Integrity (that it wasn't altered) and authenticity (that it came from who you think) are separate problems with separate machinery, and a system with confidentiality alone can be catastrophically broken. Kerckhoffs's principle, from 1883, holds that a system must remain secure with everything public except the key, which is why real cryptography is published and attacked rather than hidden.
- Substitution and Its Long DefeatUnderstand why swapping symbols never worked, through the two thousand years it took to admit it.A substitution cipher relabels letters but preserves their statistics, and al-Kindi described in the ninth century how to exploit that: the commonest ciphertext letter is probably the commonest plaintext letter. Every later scheme, up to Enigma's astronomically large key space, tried to bury the pattern deeper. Enigma nevertheless fell — not to brute force but to structure, guessed plaintext and operator habit, plus a design flaw that no letter could ever encrypt to itself. Complexity is not the same as security.
- The One Unbreakable CipherMeet the only cipher proven unbreakable, and let its impracticality name the problem the rest of the course solves.The one-time pad combines a message with a truly random key as long as the message, used exactly once, and Shannon proved in 1949 that it yields perfect secrecy: every plaintext of that length is equally consistent with the ciphertext, so the intercept contains no information at all. It is unbreakable and almost unusable, because the key is as long as everything you will ever say and must reach the other person secretly first. That last clause is the key distribution problem — the real subject of this course.
- XOR, AES, and the Modern CipherUnderstand the operation at the heart of every modern cipher, and what AES does that substitution never did.XOR is the pad's engine: combining a bit with a key bit is perfectly reversible by the same operation, and with a random key the output is random. Modern symmetric ciphers like AES use a short reusable key and repeated rounds of substitution and permutation to destroy structure — the avalanche effect means one flipped input bit changes about half the output. AES is not proven secure, and cannot be; it is trusted because it was published in an open competition and has survived a quarter-century of public attack.
- Hashing Is Not EncryptionSeparate hashing from encryption completely, and see the two jobs only a one-way function can do.A hash is one-way by design: any input produces a fixed-length fingerprint that cannot be reversed, because information is destroyed rather than hidden. That uselessness is the point — it lets a site check your password without storing it, and lets anyone verify a file is unaltered. The security property that matters is collision resistance, and it is empirical: MD5 and SHA-1 both fell, the latter to a 2017 demonstration costing about nine quintillion computations. Passwords additionally need salting and a deliberately slow function.
- The Impasse: Getting the Key to the Other PersonFeel the full weight of the key distribution problem before its solution, so the solution lands as the shock it was.With symmetric ciphers every pair of people needs their own shared key, so a network of n participants needs n(n−1)/2 keys — a thousand people need almost half a million, each delivered secretly in advance. That made secure communication a privilege of organisations with couriers, and made it flatly impossible with a stranger you will meet once, for 400 milliseconds, on a network where everything is observable. Until 1976 the field regarded this as a permanent structural fact.
- Diffie–Hellman: Mixing Paint in PublicUnderstand how two strangers build a shared secret over a channel everyone can hear — the course's central idea.Diffie and Hellman's 1976 paper showed two parties can agree a shared secret in public. The mechanism relies on a one-way function: modular exponentiation is easy forward and believed hard to reverse (the discrete logarithm problem). Each side combines their private number with a public value, exchanges the results in the open, and combines again — arriving at the same secret an eavesdropper cannot compute. GCHQ researchers had reached the same idea years earlier in secret, which was only declassified in 1997.
- Public Keys and SignaturesUnderstand the key pair, and the second thing it made possible that arguably matters more than secrecy.A key pair splits the key in two: publish one half, keep the other, and what one locks only the other opens. It rests on trapdoor functions — RSA on the belief that multiplying primes is easy and factoring the product is hard, with elliptic curves now generally preferred for equivalent security at far smaller keys. Running it in reverse gives digital signatures, which deliver the integrity and authenticity that chapter one said encryption alone never promised, and which underpin everything from software updates to certificates.
- TLS: All of It, at OnceSee every piece of the course assemble into the handshake that runs before almost every page you load.TLS is a hybrid, and the hybridity is the point: public-key cryptography is slow and symmetric is fast, so key exchange is used once to agree a session key and AES carries the actual data. The handshake agrees a cipher, runs a key exchange, presents a certificate, and switches to symmetric encryption — all in about one round trip in TLS 1.3. Modern versions require forward secrecy, using an ephemeral key discarded afterwards, so recording today's traffic and stealing the server's key later yields nothing.
- Who Do You Trust?See that the system's real weak point is identity, and that it is solved socially rather than mathematically.Key exchange gives you a secret with somebody; certificates are how you learn who. A certificate authority signs a statement binding a public key to a domain, and your browser ships with a list of authorities it trusts — meaning any one of them can vouch for any site. That is the flaw: DigiNotar's 2011 compromise produced at least 531 fraudulent certificates used against Iranian Google users, and the company was bankrupt within weeks. Certificate Transparency's public append-only logs are the structural response.
- End-to-End Encryption, and What It Doesn't HideUnderstand what E2EE changes, what it conspicuously does not, and present the policy argument without adjudicating it.Ordinary encryption protects data in transit to a company that can read it; end-to-end encryption means only the participants' devices hold the keys, so the provider cannot read the content even if compelled. What it does not hide is metadata — who, when, how often, from where — which is frequently more revealing than content, nor does it protect a compromised endpoint. The resulting law-enforcement-access debate is genuine and unresolved, and this course states both cases rather than settling them.
- Quantum: A Migration, Not an EmergencyGet the quantum threat right — neither dismissed nor inflated — and land the course's argument.Shor's algorithm would break the public-key mathematics underpinning key exchange and signatures, but not symmetric ciphers, where Grover's algorithm only halves effective strength and AES-256 remains comfortable. No quantum computer close to the required scale exists, and whether one will is disputed. The real near-term concern is harvest-now-decrypt-later against traffic that must stay secret for decades. NIST finalised post-quantum standards in August 2024 and migration is underway — which is what a well-run transition looks like, not a crisis.
Questions this course answers
Why is confidentiality alone not enough?
Three promises hide inside the word 'encrypted', and encryption alone gives you exactly one. There are real ciphers where an attacker flips a bit and turns £100 into £900 without ever learning what they changed — and the place modern cryptography actually breaks is the third promise: who am I talking to?
Why does Kerckhoffs's principle argue for publishing your algorithm?
A key is a number you can change in a second; an algorithm is embedded in every machine, manual and trained operator you own. And 'proprietary, our algorithm is a trade secret' now reads as what it is: someone who declined to have their work checked. In this field that's a confession, not caution.
Why is a scrambled-alphabet substitution cipher breakable despite having about 4 × 10²⁶ possible keys?
Al-Kindi wrote this down in ninth-century Baghdad. The size of the key space was never the question: the question is whether the cipher destroys structure, and substitution only puts a mask on it — and the mask has the same face underneath.
How was Enigma actually broken?
The key space was enormous and irrelevant, exactly as with the scrambled alphabet. Complexity is not security: a cipher with a vast key space and any exploitable structure is worse than useless, because its users go on believing in it while the enemy reads their mail.
Why doesn't brute force break a one-time pad, even with infinite computing power?
For any plaintext you can imagine there's a key producing your exact ciphertext, and since the key was random, all of them were equally likely. It isn't a computational barrier — it's an informational vacuum. That's why a quantum computer doesn't help either.
What is the one-time pad's decisive practical flaw?
It doesn't secure your communication so much as convert your problem into an identical one, moved earlier in time. That's why its real users — the Washington–Moscow hotline, embassies with couriers — all had one thing in common: they could move key material physically, in advance.
Grounded in trusted sources
- Whitfield Diffie and Martin E. Hellman, 'New Directions in Cryptography', IEEE Transactions on Information Theory, 1976 — https://ee.stanford.edu/~hellman/publications/24.pdf
- Ronald L. Rivest, Adi Shamir, Leonard Adleman, 'A Method for Obtaining Digital Signatures and Public-Key Cryptosystems', Communications of the ACM, 1978 — https://people.csail.mit.edu/rivest/Rsapaper.pdf
- Claude E. Shannon, 'Communication Theory of Secrecy Systems', Bell System Technical Journal, 1949 — https://ieeexplore.ieee.org/document/6769090
- Auguste Kerckhoffs, 'La cryptographie militaire', Journal des sciences militaires, 1883
- NIST, FIPS 197, 'Advanced Encryption Standard (AES)', 2001 — https://csrc.nist.gov/pubs/fips/197/final
- NIST, FIPS 180-4, 'Secure Hash Standard' — https://csrc.nist.gov/pubs/fips/180-4/upd1/final
- Marc Stevens et al., 'The first collision for full SHA-1' (SHAttered), CWI Amsterdam and Google, 2017 — https://shattered.io/
- CWI Amsterdam and Google, 'CWI and Google announce first collision for Industry Security Standard SHA-1', 2017 — https://www.cwi.nl/en/news/cwi-and-google-announce-first-collision-for-industry-security-standard-sha-1/
Every Wunder lesson is built from real, reputable sources — never invented.
Related Science courses
Wunder is a personalized learn-anything platform — tell it any topic and it builds a beautiful, fact-checked course in minutes, with narration, a knowledge check, and a college-style University track.
Browse more Science courses · All topics · Home
© 2026 Wunder Learning LLC · Terms & Privacy