Hash functions today
Where hash functions are used every day: digital signatures, certificates, downloads, passwords, blockchain, version control and digital evidence.
- Digital signatures and certificates
- The document’s hash value is signed, not the whole document.
- Download integrity
- Sites publish the hash value of files so that you can check they have not been altered.
- Passwords
- Sites store slow, salted hashes of passwords, not the passwords themselves.
- Blockchain
- Each block contains the hash of the previous one; in Bitcoin’s blockchain the “proof of work” consists of finding hash values with many leading zeros.
- Version control
- Code version control systems identify every file and every change with a hash value.
- Digital evidence
- Hash values attest that a forensic copy is identical to the original.
- Merkle trees
- Structures that make it possible to verify one element of a large set with a few hash values.
Hash functions: try it yourself
Hands-on exercises to compute hash values, observe the avalanche effect and estimate the birthday paradox.
The pages of this topic
Back to the overviewHash functions: how they work
How a hash function compresses data of any length into a fixed value: blocks, internal state, the Merkle-Damgård construction and the sponge construction.
Hash functions: history
From the first cryptographic hash functions to the SHA family, from MD5’s success to collisions, to the competition that produced SHA-3.
Hash functions: the maths
The birthday paradox and why security against collisions is half the length of the value, with the pigeonhole principle.
Hash functions: worked example
SHA-256 values of similar words and phrases, to see the avalanche effect, and the official test vectors.
Hash functions: weaknesses and attacks
MD5 and SHA-1 collisions, chosen-prefix attacks, length extension and precomputed tables for passwords.
Hash functions: frequently asked questions
Short answers to the most common doubts about cryptographic hash functions.