← Back to Glossary

Hash Function

A hash function is a mathematical algorithm that converts input data of any size into a fixed-length output called a hash or digest. Bitcoin relies on SHA-256, which always produces a 256-bit output regardless of whether the input is one character or a gigabyte. Changing even a single character of the input produces a completely different, unpredictable hash.

How it works

A cryptographic hash function has three key properties. It is deterministic, so the same input always yields the same output. It is one-way, meaning there is no practical method to reconstruct the input from the output. And it is collision resistant, meaning no one can feasibly find two different inputs that produce the same hash. Bitcoin uses hashing everywhere: transaction IDs are double SHA-256 hashes of transaction data, addresses are derived from hashed public keys, Merkle trees compress thousands of transactions into a single 32-byte root, and mining is a race to find a block header whose hash falls below a network-defined target.

Because the only way to find such a header is trial and error, miners collectively compute on the order of hundreds of exahashes per second, that is hundreds of quintillions of attempts every second, to produce one block roughly every ten minutes.

In the gold vs bitcoin debate

Hash functions are what let bitcoin translate physical cost into digital scarcity. Gold is hard to counterfeit because forging atoms is impossible; a bitcoin block is hard to counterfeit because reproducing its proof of work requires redoing the energy expenditure the hash represents. Both systems anchor trust in verifiable cost rather than in an issuer's promise.

Ready to convert your gold to Bitcoin?

Get Your Free Kit →