SHA-256

SHA-256 (Secure Hash Algorithm 256) is a cryptographic hash function that turns any input into a fixed 256-bit fingerprint, usually shown as 64 hexadecimal characters. Bitcoin relies on it for mining, block linking and transaction IDs.

SHA-256 is part of the SHA-2 family, designed by the US National Security Agency and published as a standard by NIST. It pads the input, splits it into 512-bit blocks and runs each block through 64 rounds of bitwise operations. The result is a 256-bit digest. The same input always gives the same output, but even a one-character change produces a completely different hash. It is also practically impossible to work backwards from a hash to the original data, or to find two inputs with the same hash.

In Bitcoin, miners repeatedly hash a block header twice with SHA-256 (double SHA-256), changing a nonce each time. They are looking for a result below the network's difficulty target. This is the core of proof of work, and it is why specialised ASIC miners are built specifically for SHA-256. The algorithm also links each block to the previous one, builds Merkle trees of transactions, and forms part of how Bitcoin addresses are derived from public keys.

Outside crypto, SHA-256 is often used to check downloaded files. If the hash of the downloaded file matches the one the publisher lists, the file has not been altered.

A common misconception is that SHA-256 is encryption. It is not: nothing is meant to be decrypted. Another is that quantum computers will easily break it. Known quantum methods would only weaken it partially, so it is considered far less exposed than the signature schemes that protect private keys.

Learn more

Related terms