In one sentence
A hash function is a calculation that turns data of any size into a short string of fixed length — a digital fingerprint that changes completely if even one bit of the input changes.
How it works
Picture a machine with one strict rule: whatever you feed in, a string of the same length comes out, and the same input always produces exactly the same string. A single word and a two-hour film both come out as, say, 256 bits, usually written as 64 hexadecimal characters.
Blockchains depend on three properties of good hash functions. They are deterministic: anyone hashing the same input gets the same output, so strangers can check each other's work without trusting each other. They are one-way: from an output there is no practical route back to the input except guessing. And they are collision-resistant: finding two different inputs with the same output is so hard that nobody has managed it for the functions in use today, such as SHA-256.
A fourth property follows in practice, the avalanche effect. Change one character of the input and roughly half of the output bits flip, so the new fingerprint looks unrelated to the old one. This is why a short hash can stand in for a large piece of data. Keep the fingerprint somewhere safe, and any later tampering with the data shows up the moment you hash it again and compare.
A simple example
A software project publishes a download together with its SHA-256 hash. After downloading, you hash the file on your own computer. If your result matches the published string character for character, you have exactly the file the developers released. If a single byte was damaged or swapped on the way, the two strings will not even look similar — there is no "nearly matching" hash.
Common misconception
Misconception: A hash is a kind of encryption, so it can be decrypted with the right key.
In fact: Encryption is designed to be reversed by whoever holds the key. A hash has no key at all and is designed never to be reversed. The only way "back" is to guess inputs and compare outputs, which is hopeless for anything that is long or unpredictable.
Where you meet it
- Linking every block to the one before it, through the block header.
- Proof-of-work mining, which is a search for a hash below a target value.
- Turning public keys into shorter addresses.
- Outside crypto: checking downloads, storing passwords safely, and version-control systems such as Git.
Related cards
Sources
This card explains a technical concept for general education. It is not a recommendation to acquire, sell or hold any crypto-asset, and it is not financial advice.