Hash functions: what makes a good one and what breaks them
What a hash function is
A cryptographic hash function takes any amount of data - one byte or one gigabyte - and produces a fixed-size fingerprint: 256 bits for the functions most blockchains use. The fingerprint is deterministic - the same input always produces the same output - and it is designed so that the output reveals nothing about the input and cannot be run backward. Hash functions are the least visible and most load-bearing component in crypto: block headers commit to transactions through them, mining is a search through their outputs, and addresses and commitments are built from them.
The three properties that make a hash good
- One-wayness: computing the hash is trivial; finding an input that produces a given hash is computationally infeasible. This is the trapdoor - the function runs easily in one direction and cannot be reversed with any known technique, which is why hashes commit without revealing.
- Collision resistance: finding any two different inputs that produce the same hash is infeasible. This is the property that makes hashes safe as identifiers - if collisions were easy, two different transactions could share a fingerprint and the commitment structure would collapse.
- The avalanche effect: changing one bit of the input changes roughly half the output bits, unpredictably. Similar inputs produce completely unrelated hashes, which is why hash outputs are used as pseudo-random values in mining, shuffling, and commitment schemes.
- Determinism and speed: the same input always produces the same output, and computation is fast for every input size. These are engineering properties, but they are what make hashes practical infrastructure rather than mathematical curiosities.
What breaks a hash function
- Collision attacks: when researchers find two different inputs with the same hash, the function is broken as an identifier. SHA-1 - used in early versions of major systems - fell to practical collision attacks, and the migration away from it was a years-long engineering program, not an overnight switch.
- Structural weakness: attacks that exploit patterns in a function's design - reduced-round variants, related-key settings - can weaken a function partially, which is why standardized functions undergo years of public analysis before adoption.
- Quantum exposure: sufficiently large quantum computers would reverse one-way functions through algorithms that current hardware cannot run at scale. The timeline is uncertain, but the exposure is real, and post-quantum hash candidates are an active research area.
- What does not break a hash: speed improvements in computing power alone. A faster computer finds collisions no faster than a slower one unless the function's structure itself is flawed - hardness is structural, not chronological.
Where blockchains depend on hash properties
- Block commitment: the Merkle root in a block header is a hash tree commitment - one-wayness keeps the commitment tamper-evident, and collision resistance keeps two different transaction sets from sharing a root.
- Addresses and identifiers: addresses derive from hashed public keys, and transaction identifiers are hashes of contents - collision resistance is what makes these identifiers usable as unique names.
- Commit-reveal schemes: voting, auctions, and game mechanisms use hashes as commitments - reveal later, prove earlier - and the scheme's honesty depends entirely on one-wayness.
Reading hash claims correctly
The takeaway
Cryptographic hash functions are fixed-size, deterministic, one-way fingerprints with collision resistance and avalanche behavior - the three properties that make commitments tamper-evident, mining exhaustive, and identifiers unique. They break through collision attacks, structural weaknesses, and eventually quantum exposure, and the history of SHA-1's fall is the standing reminder that hash security is a timeline, not a constant. Blockchains depend on every property simultaneously: headers commit through them, mines search through them, and addresses derive from them. The hash is the least discussed component in crypto and the one whose failure would invalidate every commitment at once - which is why its selection is conservatism, and its analysis is never finished.