Independent explainers · No ads · No affiliate links

Money, fintech & crypto, explained from primary sources

Glossary · Definition · Beginner

What is a hash function in blockchain?

Change one character of the input and the fingerprint changes beyond recognition. That one property holds much of a blockchain together.

Extreme close-up of the ridges of a fingerprint
Photo: “fingerprint closeup” by gfairchild, CC BY 2.0, via flickr.com. Converted to black and white.
On this page
  1. What makes a hash function secure?
  2. What does a hash look like?
  3. How do blockchains use hash functions?
  4. Questions readers ask
  5. Sources

A hash function turns data of any size into a fixed-length string called a hash or digest — a fingerprint of the data. It is easy to compute, practically impossible to reverse, and any change to the input changes the output completely. Blockchains use hashes to link blocks and derive addresses.

What makes a hash function secure?

NIST's Secure Hash Standard, FIPS 180-4, describes digests as a way to detect whether a message has changed since its digest was made. Its blockchain overview lists the three properties that make a cryptographic hash function trustworthy:

PropertyIn plain English
Preimage resistanceGiven a hash, you cannot work out the input — it is one-way
Second preimage resistanceGiven an input, you cannot find a different one with the same hash
Collision resistanceYou cannot find any two inputs that share a hash

SHA-256, the function NIST uses in its examples, always outputs 256 bits, written as 64 hexadecimal characters. Ethereum uses a different function, Keccak-256, which ethereum.org's glossary lists as its hash function.

What does a hash look like?

How do blockchains use hash functions?

NIST explains that each block header contains the hash of the previous block's header. Alter an old block and its hash changes, which breaks the link in every block after it — that is what makes the chain tamper-evident. Read more in what is a blockchain.

Hashes do other jobs too. A block's transactions can be summarised in a single root hash, for example with a Merkle tree. Your address is derived by hashing a public key. And in proof of work, miners keep changing a number called the nonce until the block header's hash falls below a target — hard to find, easy for everyone else to check. See how Bitcoin mining works.

Questions readers ask

Is hashing the same as encryption?

No. Encryption is designed to be reversed by someone with the key; a cryptographic hash is designed to be one-way, with no key that turns the digest back into the input.

Can two different inputs have the same hash?

In theory yes, because inputs are unlimited and outputs are fixed-length. A secure hash function makes finding such a pair computationally infeasible, which is what collision resistance means.

Bottom line

A hash function is a one-way fingerprint machine. Its predictability for the same input and wild change for any edit are what let blockchains chain blocks together, derive addresses and run mining — see proof of work vs proof of stake.

Sources

  1. National Institute of Standards and Technology, NISTIR 8202: Blockchain Technology Overview (2018)Primary source
  2. NIST Computer Security Resource Center, FIPS 180-4, Secure Hash Standard (SHS) (2015)Primary source
  3. ethereum.org, Ethereum glossary (2026)Primary source

Educational content only — not financial, investment, legal or tax advice. Crypto-assets are high-risk and you could lose all the money you put in. Rules differ by country; check with your national regulator. See our risk disclosure and editorial policy.