A hash function is a mathematical function that takes data of any size and returns a short string of fixed length. The result is called a HashHashA short fingerprint calculated from data, which changes completely if the data is altered by even a single character.. The hash function is the machine, and the hash is what comes out of it.
Think of a paper shredder: whatever goes through can't be pieced back together. The difference is that a hash function always gives exactly the same result for the same data.
What makes a good hash function?
- Same data, same result. Anyone who hashes the same data gets the same answer.
- Fixed length. A single word and an entire book give hashes of the same length.
- One way only. You can't work back from the hash to the data.
- No collisions. In practice, nobody should be able to find two different pieces of data that give the same hash.
- Small change, completely different result. One new character changes the whole hash.
SHA-256 in Bitcoin
Bitcoin uses the SHA-256 hash function. The number in the name refers to its output of 256 bits, written as 64 characters. There are so many possible hashes that their number runs to 78 digits. The chance of two pieces of data colliding by accident is therefore negligible.
SHA-256 turns up throughout Bitcoin:
- In MiningMiningThe process in which computers compete to solve a puzzle so they can add the next block to the blockchain and earn new bitcoin and fees., machines hash a block over and over until one result falls below the network's target. This is the heart of proof of workProof of workA consensus method where the right to add the next block to a blockchain goes to whoever first solves a hard computing puzzle..
- Every transaction gets a transaction IDTransaction ID (TXID)The unique identifier of a transaction, a long string of letters and numbers that anyone can look up in a block explorer., which is the hash of the transaction itself.
- Blocks are linked together, because each block holds the hash of the one before it.
In these cases Bitcoin actually applies SHA-256 twice in a row. Ethereum uses a different hash function, Keccak-256.
What to keep in mind
A hash function is not encryption. Encrypted data can be opened again with the right key, but nothing can be recovered from a hash. Hash functions are still part of CryptographyCryptographyMathematical methods that protect information and prove who sent it, forming the basis of security in crypto. and are used widely outside crypto, for example to check that a file you download hasn't been damaged or altered.
Everything in Myntkaup Learn is written and regularly reviewed by the Myntkaup editorial team. It is for education and is not investment advice. Editorial policy. Updated 18 October 2026.