Password Hashing Algorithms: bcrypt, Argon2 and PBKDF2 Compared
Passwords should never be stored in plain text or with fast hash functions like MD5 or SHA-256. This guide explains why slow, purpose-built password hashing algorithms are essential and how to choose one.
ProfitTool Team
Security & Dev
Why Not MD5 or SHA-256?
MD5, SHA-1, and SHA-256 are general-purpose hash functions designed to be fast. Modern GPUs can compute billions of MD5 hashes per second. If an attacker steals your database, they can crack common passwords in seconds using brute-force or dictionary attacks against fast hashes.
Password hashing algorithms are specifically designed to be slow and resource-intensive, making brute-force attacks computationally expensive.
bcrypt
bcrypt was designed in 1999 and remains widely used. It includes:
- Salt: a random value mixed into the hash, preventing rainbow table attacks
- Cost factor: controls the number of iterations (typically 10–12, doubling work per increment)
$2b$12$LQv3c1yqBWVHxkd0LHAkCOYz6TtxMQJqhN8/XYZsample...The $2b$ identifies the variant, $12$ is the cost factor. bcrypt truncates passwords at 72 bytes — passwords longer than 72 characters are treated as identical.
Argon2
Argon2 won the Password Hashing Competition in 2015 and is the modern recommendation. It offers three variants:
- Argon2d: resistant to GPU attacks, vulnerable to side-channel
- Argon2i: resistant to side-channel, weaker against GPU
- Argon2id: combines both — recommended for most uses
Parameters: memory cost (RAM required), time cost (iterations), parallelism (CPU threads). This makes it resistant to both GPU and ASIC attacks.
PBKDF2
PBKDF2 (Password-Based Key Derivation Function 2) is a NIST-recommended standard. It applies a hash function (usually HMAC-SHA256) repeatedly a configurable number of times.
- Widely supported (used in WPA2, iOS Keychain, Django)
- Less memory-hard than Argon2 — more susceptible to GPU attacks at equivalent time cost
- Recommended iteration count: 600,000+ for PBKDF2-SHA256 (OWASP 2024)
Comparison
| Algorithm | Memory-hard | GPU-resistant | NIST approved | Recommended |
|---|---|---|---|---|
| MD5 / SHA-256 | No | No | No | Never |
| bcrypt | Partially | Partially | No | Yes (legacy) |
| Argon2id | Yes | Yes | Yes (RFC 9106) | Best choice |
| PBKDF2 | No | Partially | Yes | Good (high iterations) |
Use our Hash Type Identifier to identify what algorithm a stored hash uses.
ProfitTool Team
Security & DevWritten and maintained by the ProfitTool team. Where an article references a ProfitTool utility, the behaviour described is the behaviour of the tool on this site — you can open it and check the output yourself.
More from the Knowledge Hub
How to Identify a Hash Algorithm from a Hash String
Length and character set narrow an unknown hash down fast. How to tell MD5 from SHA-256, and how to spot bcrypt, Argon2 and NTLM from their prefixes.
Privacy & SecurityHow to Check Whether a Browser Tool Processes Your Data Locally
Learn how to distinguish local browser processing from server-side and third-party requests, and what to check before entering sensitive data into an online tool.
Privacy & SecurityInside the Architecture of Privacy-Preserving AI Tools: Ephemeral Storage & Zero Retention
How ProfitTool designed a secure, production-grade AI tools platform with zero persistent prompt logging, hashed session identifiers, and client-side sanitization.