Skip to content
ProfitTool
Back to all articles
Privacy & Security
1 min read

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

AlgorithmMemory-hardGPU-resistantNIST approvedRecommended
MD5 / SHA-256NoNoNoNever
bcryptPartiallyPartiallyNoYes (legacy)
Argon2idYesYesYes (RFC 9106)Best choice
PBKDF2NoPartiallyYesGood (high iterations)

Use our Hash Type Identifier to identify what algorithm a stored hash uses.

Tags:#password hashing#bcrypt#argon2#pbkdf2#security#cryptography

ProfitTool Team

Security & Dev

Written 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.