Cryptographic hash functions
One-way, collision-resistant fingerprints. Great for integrity, but too fast to protect passwords on their own.
Properties
A cryptographic hash should be:
- Preimage resistant: given , it’s hard to find with .
- Second-preimage resistant: given , it’s hard to find with .
- Collision resistant: it’s hard to find any with . Generic attacks need about work (birthday bound).
Why not for passwords?
SHA-256 is designed to be fast. A GPU can do billions per second, so a leaked table of sha256(password) falls quickly. Password hashing needs a function that is deliberately slow and memory-hungry. That’s Argon2.
Related: How Argon2 works