SHA-256 is a precisely defined procedure that calculates a fingerprint of data, called a hash. The same input always produces the same result, 256 bits long: 32 bytes, commonly written as 64 hexadecimal characters. Bitcoin uses it to link and verify data and in mining. The fingerprint is not an encrypted copy of the original content.
Imagine someone sends you a file and its hash. By calculating the hash yourself, you can check whether the downloaded data match that fingerprint. Even a small input change is overwhelmingly likely to change the result throughout. The fingerprint alone does not tell you who created the file or whether it is safe. If an attacker supplies both a malicious file and its hash, the two will match. The source of the reference value therefore matters too. [1] [5]
For the three ASCII bytes abc, without quotation marks or a newline, the result is ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad. This is not a randomly generated number: every correct implementation produces this result from those exact bytes. Adding a space or a newline changes the input. A different hash then does not mean the algorithm has failed. Text encoding matters as well. [3]
Encryption is designed to let someone recover a message using a key. SHA-256 has neither such a key nor a reverse procedure. But that does not prevent guessing likely inputs: someone who suspects you hashed a four-digit PIN can try all 10,000 combinations and compare the results. A long hash does not give a weak secret the entropy (the unpredictability of the input) it lacks. Security also depends on how many possibilities an attacker actually needs to try. [5] [7]
Block identifiers, txid (transaction identifiers) and the combination of pairs of hashes in a Merkle Tree (a tree of linked hashes) use SHA256(SHA256(data)). The second pass processes the 32 raw bytes of the first result, not its 64-character text representation. The output is still 256 bits. Double hashing is a protocol rule here, not evidence that single SHA-256 is broken. Bitcoin also uses other constructions: Taproot, for example, adds predefined tags to the input to separate different hashing purposes. [2] [4] [6]
A miner repeatedly changes permitted fields in a candidate block header and calculates its double SHA-256. The aim is a result that, interpreted as a number, does not exceed the target (the numerical threshold). Miners are not decrypting messages or looking for someone’s private key. Finding a suitable header takes many attempts; checking it is quick. The header also refers to the previous block, so changing an older block disrupts the links that follow. A Full Node (a node that independently checks Bitcoin’s rules) checks transactions and the other rules too: a qualifying hash alone cannot make an invalid block valid. [4]
There are more possible messages than 256-bit fingerprints, so some different inputs must share the same hash. This is called a collision. What matters is whether we can deliberately find one. For an ideal 256-bit hash, a generic search for any collision takes on the order of 2^128 attempts; finding an input for a predetermined fingerprint takes on the order of 2^256. These are different tasks. Finding a collision does not by itself reveal a Bitcoin private key. Nor do these numbers guarantee the security of an entire wallet or protocol. [5]
SHA-256 is a building block, not a complete answer to every security problem. It is deliberately fast, which makes it unsuitable on its own for storing human-chosen passwords: an attacker could test guesses quickly. Dedicated password-derivation procedures serve that purpose, for example with adjustable computational cost. Likewise, a homemade recipe of “hash something and get a secure key” does not address the original randomness or an exposed input. Users usually do not need to calculate SHA-256 by hand; they should understand what a checked fingerprint proves and what it does not. [8] [7]
SHA-256 belongs to the SHA-2 family and is specified in NIST FIPS 180-4. Before calculation, it pads the input, including information about its length, and processes it in 512-bit chunks, each through 64 rounds. These internal blocks contain 64 bytes and are not Bitcoin blocks. A Bitcoin block header contains 80 bytes; the whole Bitcoin block also contains transactions. The 256 in the name refers to the length of the resulting fingerprint, not the size of a block or private key. [1] [4]
For the clearest picture, read this entry together with Hash, Proof of Work, Block Header, Bitcoin address, Merkle Tree, Bitcoin. The reverse links also lead from Hash, ASIC Miner, Hashrate, Nonce.