// learn · episode 01
What is a hash?
A hash is a fingerprint for data. Feed anything in — a word, a contract, a whole hard drive — and out comes a short, fixed-length code used to compare data. Hashing is a building block of blockchain, and you’re about to use it. Everything on this page runs in your browser; nothing you type leaves the page.
01 · try it
Text in, fingerprint out
This playground uses MD5 for learning. Its collision resistance is broken, so it must not protect signatures or other uses that require collision resistance. Type below and watch the fingerprint change, then try the presets that differ by one capital letter.
md5 fingerprint
5d41402abc4b2a76b9719d911017c592
input: 5 characters → output: always 32 hex characters (128 bits).
Deterministic
The same input always gives the same hash. Type it again next year, on another machine — identical fingerprint.
Fixed length
One letter or a whole book: the MD5 output is always 32 hex characters (128 bits). Even empty text has a hash.
Avalanche effect
Change one character and roughly half the output flips. Nothing about the new hash hints it was a small edit.
02 · one-way street
Finding an input is a different task
A hash does not uniquely identify its original input. A secure hash is designed to make finding a matching input computationally impractical, but short or predictable secrets can be guessed. This demo searches candidate inputs and compares their fingerprints.
Crack this PIN
search space: 10,000Behind this hash hides a 4-digit PIN. You can't reverse the hash — but you can guess forwards. Try a guess, or let your machine try all 10,000.
4a7d1ed414474e4033ac29ccb8653d9b
Now try this one
search space: 94¹² ≈ 4.8 × 10²³This hash hides a full sentence. Same attack, same machine — completely different outcome.
8e6883fb18963b2d27e84e6dad47a065
03 · the birthday attack
Two texts, one hash
Collision resistance means it is computationally impractical to find two different inputs with the same hash. Finding any matching pair is a different task from matching a particular document’s hash. The shortened fingerprint below makes the birthday effect visible.
Hunt for a collision
mini-hash = first 6 hex chars (24 bits)We compare only the first 24 bits of MD5. Assuming independent, uniformly distributed outputs, matching a specific 24-bit value takes about 16.7 million trials on average. Finding any matching pair is much quicker: about 4,823 trials give a 50% chance of a collision. That is the birthday effect; a particular run may take fewer or more trials.
04 · proof of work
Mining is hashing with a target
This toy miner applies SHA-256 once to your text and a counter (the nonce), looking for a hash with the chosen leading hexadecimal zeros. Bitcoin instead hashes an 80-byte block header with SHA-256 twice and compares the result as a number against its target. The demonstration illustrates repeated trials, rather than reproducing Bitcoin’s block format.
Bitcoin block-header reference ↗
target: hash starts with “0000” — expected ~65,536 tries. Each extra zero ≈ 16× harder.
05 · not all hashes age well
MD5, SHA-1, SHA-2, SHA-3
Hash algorithms offer different security properties and designs. MD5 is useful here as a teaching example; current security work requires algorithms appropriate to the application.
- 1992
MD5
BrokenFull MD5 collisions were published in 2004 using cryptanalytic techniques. The toy birthday search above is different. MD5 must not be used where collision resistance is required.
- 1995
SHA-1
RetiredSHAttered demonstrated a full SHA-1 collision in 2017. SHA-1 is unsuitable for applications requiring collision resistance.
- 2001
SHA-2 (SHA-256)
Today's standardSHA-256 belongs to the SHA-2 family. Bitcoin applies it twice to a block header; this toy miner applies it once to text and a counter.
- 2015
SHA-3
Different designA standard family based on a different construction, with fixed-length hashes and extendable-output functions. It complements SHA-2 rather than existing only as an emergency replacement.
Choose a hash for the properties your application needs, and plan how to change algorithms as standards and attack techniques evolve. Collision resistance, preimage resistance, and authentication are different requirements.
MD5 security considerations ↗NIST SHA-3 standard ↗SHAttered research ↗
next up
Episode 02 — Blocks & chains play now →Next: how chaining hashed blocks makes history tamper-evident.