Encryption and online security
How secret codes evolved from Caesar's shifts to public-key cryptography that protects every online payment.
01The basic idea
Encryption scrambles a message, called plaintext, into an unreadable form, called ciphertext, using a mathematical procedure and a key. Only someone with the right key can reverse the process and read the message.
A central principle of modern cryptography, stated by Auguste Kerckhoffs in 1883, is that a system should stay secure even if everything about it except the key is public. Security that depends on keeping the method secret tends to fail once the method leaks.
02Classical ciphers
Julius Caesar reportedly used a simple substitution cipher that shifted each letter three places along the alphabet. Such ciphers are easy to break by frequency analysis: in English, e is the most common letter, so the most common symbol in a long ciphertext probably stands for e. The Arab scholar al-Kindi described this technique in the ninth century.
More complex systems followed. During the Second World War, Germany used the Enigma machine, whose rotors changed the substitution with every key press. Polish mathematicians first broke early Enigma messages, and British codebreakers at Bletchley Park, including Alan Turing, built machines that read large amounts of German traffic.
03Symmetric encryption
In symmetric encryption, the same key locks and unlocks the data. Modern symmetric ciphers such as the Advanced Encryption Standard, adopted by the US government in 2001, are extremely fast and, with a long enough key, cannot practically be broken by trying every possibility.
The weakness is key distribution. If two people have never met, how do they agree on a secret key without an eavesdropper learning it? For most of history the answer was couriers and codebooks.
04Public-key cryptography
In 1976 Whitfield Diffie and Martin Hellman published a method for two parties to agree on a shared secret over a public channel. The following year Ron Rivest, Adi Shamir and Leonard Adleman published RSA, which uses a pair of keys: a public key that anyone can use to encrypt a message, and a private key, kept secret, that decrypts it. British intelligence researchers had found similar ideas earlier but kept them classified.
RSA's security rests on a mathematical asymmetry: multiplying two large prime numbers is easy, but factoring the result back into those primes is extraordinarily hard. Key pairs also enable digital signatures, which prove a message came from the holder of a private key and was not altered.
05How it protects you online
- HTTPS uses TLS, which combines public-key methods to agree on keys with fast symmetric encryption for the data itself.
- Certificates, signed by trusted certificate authorities, prove that a website really belongs to its claimed owner.
- End-to-end encrypted messaging apps keep keys on users' devices, so the service provider cannot read messages.
- Password systems store hashes, one-way scrambles of passwords, rather than the passwords themselves.
06Weak points and the future
Most real attacks go around encryption rather than through it. Phishing tricks people into handing over passwords, malware reads data before it is encrypted, and reused passwords let one breach unlock many accounts. Two-factor authentication and password managers defend against these common threats.
A large enough quantum computer could break RSA and similar systems by factoring numbers efficiently. No such machine exists yet, but in 2024 the US National Institute of Standards and Technology published its first post-quantum encryption standards, and organisations have begun migrating to them.
Test yourself
What does “Ciphertext” mean?
Which term matches this description: Encryption where the same key is used to encrypt and decrypt.
What does “Public key” mean?
Which term matches this description: A fixed-length fingerprint of data that cannot practically be reversed.
About this guide
An original guide written for Fathomly. © 2026 Fathomly, all rights reserved. Spotted an error? Send a correction.