1 min read
SHA-256 is a cryptographic hash function. A cryptographic hash function has a few key properties. It takes an input, called a preimage, and produces an output of a fixed length—all SHA-256 outputs are 256 bits long. This process is deterministic, meaning a given input will produce the exact same output every time. Hash functions are also unpredictable: the slightest change to an input yields an entirely different output, such that it is infeasible to craft a desired output or calculate an input based on the outputs. SHA-256 is a member of a family of hash functions called Secure Hashing Algorithm (SHA) functions.
The Bitcoin protocol uses SHA-256 to derive transaction IDs (txids), block hashes, addresses, and Merkle trees. Occasionally, SHA-256 is applied twice, as in the case of txids.