← Melio Blog

How Cryptography Works

The math that lets you send a secret across a world full of eavesdroppers, and why even a supercomputer running for billions of years couldn't crack it. A picture for every idea.

01

The Problem: Everyone's Listening

secrets on an open wire

Every message you send online passes through machines you don't control. So how can you type a password or send a private message safely? The answer is cryptography: scrambling a message so that only the right person can unscramble it, even if everyone in between can see the scrambled version.

you "my password" ←readable? eavesdropper friend
The whole challenge: send something only your friend can read, on a line everyone can see.

02

The Old Way: One Shared Key

same key locks and unlocks

The classic method: you and your friend share a secret key. You use it to scramble (lock) the message; they use the same key to unscramble (unlock) it. Fast and effective, but there's a catch that stumped people for centuries: how do you share the key in the first place without an eavesdropper grabbing it?

lock πŸ”’ πŸ”‘ unlock πŸ”“ πŸ”‘ same key ⚠ how to share the key safely?
Symmetric encryption is great, once both sides have the key. Getting it to them safely was the unsolved puzzle.

03

The Breakthrough: Two Keys

public-key cryptography

The genius idea that powers the modern internet: give everyone two keys, a public key and a private key. You hand out your public key freely (it only locks). You keep your private key secret (it's the only thing that unlocks). Now anyone can send you a locked message, but only you can open it, and you never had to share a secret first.

Think of it like β†’ mailing everyone an open padlock that only your key opens. They snap a message shut with your padlock; no one can reopen it but you.
PUBLIC key πŸ”“ given to everyone (only locks) β†’ locks β†’ πŸ”’ msg β†’ PRIVATE key πŸ”‘ kept secret by you (only unlocks)
Two different keys for one mailbox. The lock is public; the unlock is yours alone.

04

Why It Can't Be Reversed

one-way math

Public-key crypto rests on math that's easy to do one way but practically impossible to undo. For example, multiplying two huge prime numbers is quick. But taking the giant result and figuring out which two primes made it? That could take the fastest computers longer than the age of the universe. The lock is trivial to close and effectively impossible to pick.

61 Γ— 53 β†’ 3,233 instant βœ“ 3,233 ← ?? Γ— ?? with real-world huge numbers: ~forever βœ—
(Tiny numbers shown for clarity; real keys use numbers hundreds of digits long, where reversing is hopeless.)

05

Signatures: Proving It's Really You

the two keys, used in reverse

The two-key trick does something else amazing. If you scramble something with your private key, anyone can check it with your public key, proving it could only have come from you, and that no one altered it. That's a digital signature. It's how your device knows an app update is genuine, or that a website is the real one and not an impostor.

sign with PRIVATE πŸ”‘ message ✍ β†’ sent across the wire β†’ βœ“ verified, untampered checked with PUBLIC key
Encryption keeps messages secret; signatures prove they're authentic. Modern security needs both.

06

Why Brute Force Doesn't Work

the numbers are simply too big

Couldn't an attacker just try every possible key? In theory, yes. In practice, the number of possible keys is so vast that trying them all would take longer than the universe has existed, even with every computer on Earth combined. Security here isn't about hiding the method (it's public knowledge); it's that the math makes guessing hopeless.

possible keys to try: 115,000,000,000,000,000,000,000,000,000,000,000+ all computers on Earth would still need billions of years
This is why your messages, banking, and logins hold up: not secrecy of the lock, but the scale of the math.

The Whole Story in 6 Steps

1

The problem. Send secrets over lines that everyone can see.

2

Shared key. Same key locks and unlocks, but sharing it safely was the hard part.

3

Two keys. A public key anyone can lock with, a private key only you can unlock with.

4

One-way math. Easy to lock, effectively impossible to reverse without the private key.

5

Signatures. Using the keys in reverse proves a message is authentic and untampered.

6

Brute force fails because the number of possible keys is astronomically large.

Quick Glossary

Encryption: scrambling data so only the right person can read it.
Key: the secret value that locks or unlocks a message.
Symmetric: one shared key used to both lock and unlock.
Public key: shared freely; used to lock messages to you.
Private key: kept secret; the only thing that unlocks them.
Digital signature: proof a message truly came from you, unchanged.
Hash: a fixed-length "fingerprint" of data (used for passwords and integrity).
Brute force: trying every possible key; defeated by sheer scale.

Keep Reading

How GPS Works: How a tiny chip in your phone pinpoints your spot on Earth to within a few meters. Read →
How Airplanes Fly: How a 400-ton machine lifts off and stays in the air using four simple forces in balance. Read →
How Black Holes Work: Why gravity is really a bend in space and time, and what makes a black hole a true point of no return. Read →

Browse all the Melio Blog guides →