← GlossaryMining
What Is a Hash Function? The Tool Behind Blocks and Mining
Hash Function — A cryptographic hash function turns input of any size into a fixed-size output, called a hash or digest, in a way that is easy to compute but infeasible to reverse or to find two inputs that produce the same output.
Key takeaways
- The same input always gives the same hash.
- Changing one bit of the input changes the whole output unpredictably.
- You cannot work backwards from a hash to its input except by guessing.
- Blockchains use hashes to link blocks, summarise transactions and prove work.
What a hash is
A hash function takes data of any size, a word, a file or a whole block, and produces a short fixed-length value. For SHA-256, that value is always 256 bits. The result is a fingerprint: the same input always yields the same hash, while different inputs yield different, unrelated-looking hashes. Cryptographic hash functions are designed so that the output reveals nothing useful about the input.
Properties that matter
Three properties make hashes useful in blockchains. They are one-way: given a hash, finding an input that produces it is infeasible except by trying inputs. They resist collisions: finding two different inputs with the same hash is infeasible. And they show the avalanche effect: a tiny change to the input changes roughly half the output bits. Together these let anyone verify data quickly while making tampering detectable.
How blockchains use them
Hashes link each block to the previous one, summarise a block's transactions into a merkle root and create addresses from public keys. In proof of work they are also the puzzle: miners search for an input whose hash is below a target, and since there is no shortcut, the only way is to try many inputs. Verification is one hash.
Different hash functions, different hardware
Bitcoin uses SHA-256, while Litecoin and Dogecoin use Scrypt for their proof of work. The choice affects what hardware is efficient, because functions that need more memory behave differently on chips than ones that do not. The security idea is the same in every case.
Example
Hashing the word 'wallet' with SHA-256 gives a 64-character hexadecimal string. Hashing 'Wallet' with a capital W gives a completely different 64-character string, even though the inputs differ by one letter.
Put it into practice
Compare hash functions by what they pay
Scrypt and SHA-256 coins need different machines. The mining calculator models Scrypt hashrates for Litecoin and Dogecoin so you can compare before you buy.
Open the mining calculator Get Scrypt for AndroidFrequently asked questions
Can a hash be reversed?
Not by calculation. You can only guess inputs and compare, which is why strong hashes protect data and make mining a trial-and-error search.
Is a hash the same as encryption?
No. Encryption can be reversed with a key. A hash has no key and is not meant to be reversed.
Why do two different coins use different hash functions?
Different designs aim at different hardware and security trade-offs, which affects who can mine economically.
Written by the Scrypt Wallet team · Updated 2026-10-02. General education, not financial, tax or legal advice.