Why Password Hashing Matters
When users create passwords, you should never store the raw password in your database. If your database is ever breached, attackers will have every user's password in plain text. Instead, store a one-way hash of the password — a mathematical fingerprint that cannot be reversed.
Why MD5 and SHA256 Are Wrong for Passwords
MD5, SHA256 and SHA512 are cryptographic hash functions designed for speed. A modern GPU can compute billions of SHA256 hashes per second. This makes them terrible for passwords — an attacker can try an entire dictionary of common passwords in milliseconds.
Why Bcrypt Is Different
Bcrypt is intentionally slow. It was designed specifically for password hashing with three key properties:
- Adaptive cost factor — you control how slow it is, so it can be made slower as hardware improves
- Automatic salting — bcrypt generates a random salt for each hash, so identical passwords produce different hashes
- Purpose-built — designed specifically for passwords, not general-purpose hashing
Understanding the Cost Factor
The cost factor (also called work factor) is a number that determines how many iterations bcrypt performs. At cost 10, bcrypt performs 2¹⁰ = 1,024 iterations and takes about 100ms. At cost 12, it performs 4,096 iterations and takes about 400ms. The OWASP recommendation is a minimum cost factor of 10.
Generate and Verify Bcrypt Hashes
Our Bcrypt Hash Generator generates real bcrypt hashes server-side using PHP's password_hash() function and verifies passwords against existing hashes.


