A hash function takes any data, a word or a whole block, and returns a short fixed size result. Bitcoin uses SHA-256, whose result is 256 bits, usually written as 64 hexadecimal characters.
Four properties that matter
- Same input, same output: anyone can recompute it and check.
- Change one character and the result changes completely.
- One way: you cannot work back from the hash to the data.
- No known way to find two different inputs with the same hash.
These properties turn a hash into a fingerprint. If a block's hash matches, the block is exactly the one expected, down to the last bit. If anything was altered, the fingerprint no longer fits.
Where Bitcoin uses it
Block hashes chain the blocks together. Transaction ids are hashes of the transactions. Addresses are built from hashes of public keys. Mining itself is a search for a block hash below a target. Bitcoin mostly hashes twice in a row, SHA-256 of SHA-256, as an extra safety margin.
▶ SEE IT IN THE MACHINEBLOCK HASH, the press, is where the block's fingerprint is struck once the miner has found it.