Cryptographic Hash Function
Last Updated: November 16, 2026
A cryptographic hash function is an algorithm that turns any input into a fixed-size output, called a hash, in a way that cannot be reversed or forged in practice. It is a building block of blockchains, Bitcoin mining and digital signatures.
How Cryptographic Hash Functions Work
The function splits data into fixed-size pieces and mixes them through many rounds of simple steps. A small change in the input gives a completely different hash, and the process cannot run backward. That makes tampering easy to spot, which is why hash functions are vital for digital signatures and blockchain systems.
Key Properties
A hash function counts as cryptographic only if it passes several security tests. NIST rates them in bits, and each extra bit doubles the work an attacker needs.
| Property | What it means | SHA-256 rating (NIST) |
|---|---|---|
| Preimage resistance | You cannot find an input from its hash | 256 bits |
| Second-preimage resistance | You cannot find a second input with the same hash as a given one | About 256 bits, a bit less for very long inputs |
| Collision resistance | You cannot find any two inputs with the same hash | 128 bits |
| Avalanche effect | One changed input bit flips about half the output bits | Design goal |
Collision resistance is rated lower because of the birthday paradox: it is much easier to find any two matching outputs than to match one chosen output.
Common Hash Functions in Crypto
| Function | Output size | Main crypto use |
|---|---|---|
| SHA-256 | 256 bits | Bitcoin mining, block hashes and transaction IDs |
| Keccak-256 | 256 bits | Ethereum addresses, transaction hashes and smart contracts |
| RIPEMD-160 | 160 bits | Bitcoin addresses, applied after SHA-256 |
| SHA-1 | 160 bits | Retired for security use after the 2017 collision |
SHA-256 is the best-known example. It is part of the SHA-2 family in NIST’s FIPS 180-4 standard, and it always gives 64 hex characters.
Ethereum’s Keccak-256 is the original design that won NIST’s SHA-3 contest in October 2012. NIST changed its padding before it published SHA-3 in August 2015, so the two give different results. For an empty input, Keccak-256 starts with c5d24601 and SHA3-256 with a7ffc6f8. The Solidity docs list keccak256 as a built-in function.
Example: One Broken Function, One Strong Function
Hash functions can fail. On February 23, 2017, Google and the CWI Institute in Amsterdam showed two different PDF files with the same SHA-1 hash. It took about nine quintillion SHA-1 computations. In December 2022, NIST said SHA-1 should be phased out by December 31, 2030, in favor of SHA-2 or SHA-3.
SHA-256 has no such break. NIST still lists it as approved on November 16, 2026, and no practical attack on the full function has been published. Bitcoin miners alone ran about 975 quintillion double SHA-256 hashes per second that day, according to mempool.space at 19:10 UTC.
Quantum Computing and Hash Functions
Quantum computers are a smaller threat to hash functions than to digital signatures. Grover’s algorithm could speed up a brute-force search and roughly halve the security level, so a 256-bit hash would keep about 128 bits. IETF RFC 9958, from June 2026, says hash functions face a lower risk than public-key systems.
So the main quantum worry for Bitcoin is exposed public keys, not mining. Our explainer on whether quantum computers can break Bitcoin covers that risk and the plans to deal with it.
Applications of Cryptographic Hash Functions
- Blockchain Security: Hash functions link blocks together and secure the integrity of the blockchain.
- Password Storage: Hash functions store passwords so they are not retrievable even if the database is stolen. Slow hash functions are used for this.
- Data Integrity: Comparing hash values reveals any change to a file or message, such as a wallet download.
Where to Check
NIST’s Computer Security Resource Center lists the approved hash functions and their strengths: the SHA-2 family in FIPS 180-4 and SHA-3 in FIPS 202. Each blockchain’s own documentation names the function it uses.
Limits
A hash function only proves that data is intact. It cannot hide data that is easy to guess, and it cannot prove who sent a message; that takes a digital signature. Systems that still use MD5 or SHA-1 for security are open to known attacks.
Frequently Asked Questions
What makes a hash function cryptographic?
It must be one-way and hard to fool. There should be no practical way to find an input from its hash, to find a second input that matches a given one, or to find any two inputs with the same output. Simple hash functions used in databases are fast but fail these tests, so they are not safe for security.
Which hash functions do Bitcoin and Ethereum use?
Bitcoin uses SHA-256, applied twice, for block hashes, mining and transaction IDs. For many addresses it applies SHA-256 and then RIPEMD-160 to the public key. Ethereum uses Keccak-256, the original version of the SHA-3 winner, for addresses, transaction hashes and smart contracts. Its main programming language offers all three as built-in functions.
Can quantum computers break hash functions?
Not in a practical sense. The best known quantum method, Grover’s algorithm, would roughly halve the security level, leaving SHA-256 with about 128 bits of preimage strength. That is still far beyond the reach of any machine. The bigger quantum risk for blockchains is to digital signatures, which protect the keys that control coins.
Data sources: NIST CSRC (approved hash functions and SHA-256 strengths, read November 16, 2026); NIST (December 15, 2022); Google Security Blog (February 23, 2017); IETF RFC 9958 (June 2026); Solidity docs; mempool.space (19:10 UTC, November 16, 2026); Keccak-256 and SHA3-256 outputs computed November 16, 2026.