25 / 691SHA²

SHA-256

256-bit SHA-2 family function

A specific hash algorithm used in several Bitcoin constructions.

SHA-256 in FIPS 180-4 produces a 256-bit digest: 32 bytes or 64 hexadecimal characters. The 256 denotes output length, not Bitcoin block size or an encryption-key size.

The algorithm pads the message including its length, processes 512-bit chunks and performs 64 rounds on 32-bit words per chunk. These internal blocks are 64-byte computational pieces. A Bitcoin header is 80 bytes and a whole Bitcoin block also contains transactions: a different meaning of block. [NIST FIPS 180-4: SHA-256]

For a Bitcoin header, SHA-256 first hashes serialized header bytes, then SHA-256 hashes the 32 raw bytes of that result. It does not hash the 64-character hexadecimal representation. Output does not expand to 512 bits; constructions such as Taproot tagged hashes use SHA-256 differently. [Bitcoin Core v29.0: hash constructions]

For the three ASCII bytes abc without quotes or newline, SHA-256 starts ba7816bf8f01cfea and the full result has 64 hex characters. Adding a newline changes the message. Compare implementations using known test vectors and specify input encoding, hash count and byte-display convention. [Bitcoin Core v29.0: hash test vectors]

For the clearest picture, read this entry together with Cryptographic hash, Proof of Work, Block header, Bitcoin address, Merkle tree, Bitcoin. The reverse links also lead from Cryptographic hash, Hashcash.

DOC · 001NIST FIPS 180-4: SHA-256PrimaryDOC · 002Bitcoin Core v29.0: hash constructionsPrimaryDOC · 003Bitcoin Core v29.0: hash test vectorsPrimary
Reviewed 1 August 2026Source-first · No investment advice