Blockchain explained
Series
Blockchain explained
Lesson
01 of 06
Edition
November 2026
References
3

Hashing: a fingerprint for any data

Abstract

A hash function turns any data into a short, fixed-size fingerprint. Change one character and the fingerprint changes completely: that is how a blockchain notices tampering.

Key points

  1. The same input always gives the same hash, and SHA-256 always gives 256 bits (64 hex characters), whatever the size of the input.
  2. Change a single character and about half of the bits change, with no visible pattern.
  3. Going backwards is impractical: from a hash you cannot recover the input, nor find another input with the same hash.

LimitsWhere this toy model differs from the real system: Limits

What a hash function does

A hash function reads data of any length (a word, a contract, a whole film) and returns a string of fixed length called the digest, or simply the hash. SHA-256, the function Bitcoin is built on, returns 256 bits, usually written as 64 hexadecimal characters. It is deterministic: the same input gives the same output on any computer, every time.

Figure 1Try it: SHA-256

Reference: blockchain
ef7797e13d3a75526946a3bcf00daec9fc9c9c4d51ddc7cc5df888f74dd434d1
Now
ef7797e13d3a75526946a3bcf00daec9fc9c9c4d51ddc7cc5df888f74dd434d1

Bits changed0 / 256Hex characters changed0 / 64

This widget needs JavaScript. The text of the lesson explains the same idea without it.

Three properties that matter

Avalanche. A tiny change in the input produces a completely different hash. In the widget, changing one letter flips about half of the 256 bits, and the new hash keeps no trace of the old one.

One-way. Given a hash, there is no known shortcut for finding an input that produces it. The only method is to try inputs one by one, and for 256 bits that is far beyond any computer.

Collision resistance. Two different inputs with the same hash must exist, because there are infinitely many inputs and only 2²⁵⁶ possible hashes. But nobody knows how to find such a pair for SHA-256.

Why a blockchain needs it

A hash works as a fingerprint. Keep the hash of a document, and later you can tell whether the document changed by hashing it again and comparing. A blockchain uses this idea everywhere: each block contains the hash of the block before it (lesson 2), mining searches for hashes of a special shape (lesson 3), and a Merkle tree sums up thousands of transactions in a single hash (lesson 4).

Limits

Sources

Primary sources this lesson is based on.