SHA-256

A cryptographic hash function that turns data into a fixed 256-bit fingerprint, securing Bitcoin blocks and proof-of-work mining.

SHA-256 (Secure Hash Algorithm 256-bit) is a cryptographic hash function that converts any input data, such as a transaction or an entire block, into a fixed-length 256-bit (32-byte) output called a hash. It is designed to be one-way, meaning it is computationally impractical to reverse a hash back into the original data. It is also built to make even tiny changes in the input produce a completely different output, which helps detect tampering.

How SHA-256 works in practice

In everyday crypto use, SHA-256 acts like a digital fingerprint for data. Whether you hash a single sentence or a large file, the output length stays the same, but the result is unique enough that two different inputs should not produce the same hash under normal assumptions. This property supports data integrity checks, if the stored hash and the newly computed hash match, the data has not been altered.
SHA-256 is part of the SHA-2 family, originally designed by the U.S. National Security Agency and standardized for broad security applications. Its security relies on properties like preimage resistance (hard to find an input that matches a given hash) and collision resistance (hard to find two different inputs with the same hash).

SHA-256 in Bitcoin and proof of work

Bitcoin uses SHA-256 extensively, including when hashing transactions into a Merkle tree and when linking blocks together through the previous block hash. Most famously, SHA-256 is central to Bitcoin’s proof-of-work. Miners repeatedly hash block header data while adjusting a nonce, searching for a hash that meets the network’s difficulty target. This makes producing a valid block costly, while verifying it is fast for any node.

SHA-256 matters because it underpins the integrity and immutability guarantees of proof-of-work blockchains, enabling participants to independently verify history without trusting a central party.