Updated Nov 4, 2026#hashing

Cryptographic hash functions

One-way, collision-resistant fingerprints. Great for integrity, but too fast to protect passwords on their own.

Properties

A cryptographic hash H:{0,1}∗→{0,1}nH : \{0,1\}^* \to \{0,1\}^n should be:

  • Preimage resistant: given yy, it’s hard to find xx with H(x)=yH(x) = y.
  • Second-preimage resistant: given xx, it’s hard to find x′≠xx' \ne x with H(x′)=H(x)H(x') = H(x).
  • Collision resistant: it’s hard to find any x≠x′x \ne x' with H(x)=H(x′)H(x) = H(x'). Generic attacks need about 2n/22^{n/2} 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

esc
Type to search