Track 0 · Genesis · lesson 2
Hash it yourself
3 min
Track 0 · Genesis · lesson 2
3 min
Last lesson ended with a problem: if everyone holds a copy of the ledger, what stops someone editing theirs?
The answer is a hash function. Play with one before we define it.
Change one letter. Watch the whole thing change.
A hash function takes any input — a word, a book, a film — and returns a fixed-length fingerprint. The same input always gives the same fingerprint. A different input gives a different one.
That output is 256 bits, written as 64 hex characters. It is the same length whether you hash one letter or a gigabyte.
Type hello above, then change it to hellO. Watch what happens to the digest.
The two outputs have nothing in common. Not "mostly similar with a few differences" — completely unrelated. This is called the avalanche effect, and it is deliberate: flipping a single input bit flips about half the output bits.
Predict
2cf24dba…, how would you find the input that produced it?Now the useful part. Each block stores the hash of the block before it.
✓ every link matches
Edit block 13 and its hash changes — the avalanche effect guarantees it. But block 14 stored the old hash of block 13. The link no longer matches, and block 14 is now visibly broken. So is 15, and every block after it.
You cannot quietly change history. You can only change it loudly, and everyone holding a copy sees the break instantly.
Check
People mix these up constantly, and the distinction matters.
Encryption is reversible by design: with the key you get the original back. Hashing is one-way and lossy: there is nothing to get back. A hash is a fingerprint, not a locked box.
Blockchain data is not encrypted. Every transaction on Ethereum is public, and anyone can read all of it. Privacy on a public chain comes from the fact that an address is not obviously attached to a name — which is much weaker protection than people assume.