SHA-256

A cryptographic hash function that turns any input into a fixed 256-bit output; the hash function used by Bitcoin.

What is SHA-256?

SHA-256 is a cryptographic hash function. It takes an input of any size and produces a fixed-length output of 256 bits, usually written as 64 hexadecimal characters. It belongs to the SHA-2 family, which was designed by the US National Security Agency and published as a standard by NIST. Bitcoin relies on SHA-256 throughout its design.

How it works

A hash function is a one-way calculation. SHA-256 has the properties that make such a function useful for security:

A hash is often described as a digital fingerprint of data.

Example

Hashing the word "bitcoin" gives one 64-character string. Hashing "Bitcoin", with a capital B, gives another string that has no visible resemblance to the first. Anyone can repeat the calculation and will get the same results.

How Bitcoin uses it

Why it matters

The security of Bitcoin's ledger depends on SHA-256 behaving as designed. No practical attack that breaks it is publicly known.

Common misunderstandings

Hashing is not encryption: there is no key and nothing to decrypt. Ethereum mainly uses a different hash function, Keccak-256.

Related terms