network

hash

A mathematical function that converts any input into a fixed-length string of characters. Bitcoin uses SHA-256 to link blocks and verify data. Hashes are one-way: the original input cannot be recovered from the output.

A hash function is a mathematical algorithm that takes any input, whether a single word, a transaction record, or an entire block of data, and produces a fixed-length string of characters called a hash or digest. No matter how large or small the input, the output is always the same length. Bitcoin uses SHA-256, which produces a 256-bit output, typically displayed as a 64-character hexadecimal string.

Hash functions are one-way: given a hash output, it is computationally infeasible to determine the original input. They are also deterministic, meaning the same input always produces the same output. Even a tiny change to the input, altering a single character, produces a completely different hash. This sensitivity is known as the avalanche effect and makes hashes reliable tools for detecting any modification to data.

In Bitcoin, hashes serve several critical roles. Each block contains the hash of the previous block, which chains them together and makes the blockchain tamper-resistant. Mining requires finding a hash output that falls below a specific target value, which demands enormous computational effort. Transaction identifiers are also hashes, allowing anyone to look up any transaction in the blockchain by its unique fingerprint.

Frequently asked questions