2.5 Hash Functions (SHA-256)
One-way functions, why they matter, and how Bitcoin uses them everywhere.
Hash Functions (SHA-256)
A hash function is like a digital meat grinder. You can put anything in — a word, a book, a movie file — and out comes a fixed-size string of letters and numbers, the same length every time. Bitcoin uses one called SHA-256.
A hash function is like a digital meat grinder. You can put anything in — a word, a book, a movie file — and out comes a fixed-size string of letters and numbers, the same length every time. Bitcoin uses one called SHA-256.
Three things make hash functions magical for Bitcoin:
1) The same input always gives the same output, but even a tiny change (one letter, one pixel) completely scrambles the result. So fingerprints are reliable but very sensitive.
2) You can't reverse the grinder. Given a hash, there's no shortcut to figure out what went into it — your only option is to keep guessing inputs until you find one that matches.
3) It's effectively impossible to find two different inputs that produce the same hash, so each fingerprint uniquely identifies its content.
Bitcoin uses these fingerprints everywhere: in addresses, in transactions, in linking blocks together, and in the mining race itself. Mining is basically a planet-sized guessing contest to find an input whose hash starts with enough zeros.
