Skip to content

Free 15-minute cybersecurity consultation — no obligation

Book Free Call
Learnlearn32 min readDeep Dive

Password Hashing Algorithms: bcrypt, Argon2, scrypt Compared

Compare password hashing algorithms including bcrypt, Argon2, and scrypt. Which to use, which to avoid, and why it matters for security.

Password Hashing Algorithms: bcrypt, Argon2, scrypt Compared - password hashing algorithms

The best password hashing algorithms in 2026 include Argon2id, bcrypt, scrypt, and PBKDF2, each engineered to protect user credentials against increasingly sophisticated attack methodologies. With modern GPUs capable of testing over 180 billion password attempts per second against weak algorithms like MD5 and SHA-1, selecting the appropriate hashing function directly determines whether your authentication system withstands or succumbs to breach attempts.

According to the 2026 Hive Systems Password Table, even complex 8-character passwords protected by outdated algorithms can be compromised in minutes, while properly configured modern algorithms create computational barriers that remain effective against current attack capabilities.

The Cybersecurity and Infrastructure Security Agency (CISA) reports that legacy algorithms create security gaps exploitable by commodity hardware, necessitating immediate migration to memory-hard, GPU-resistant alternatives. This comprehensive guide examines the technical characteristics, implementation parameters, and security trade-offs of leading password hashing algorithms to support informed architectural decisions for authentication systems in 2026.

Key Takeaway

Compare password hashing algorithms including bcrypt, Argon2, and scrypt. Which to use, which to avoid, and why it matters for security.

Password Security By The Numbers

180B
Password Attempts Per Second

Modern GPU capability against weak algorithms

1,000x
Attack Efficiency Reduction

Memory-hard algorithms vs general-purpose hashes

72
Byte Input Limit

bcrypt password length restriction

Why Password Hashing Algorithm Selection Determines Security Posture

Password hashing serves as the final defensive layer when authentication databases are compromised. Unlike encryption, which remains reversible with key access, cryptographic hashing implements one-way mathematical functions that cannot be inverted to reveal original passwords. The security effectiveness depends entirely on computational cost—weak algorithms allow attackers to test billions of password candidates per second, while properly selected algorithms reduce attack speed to single-digit attempts per second on the same hardware.

The OWASP Password Storage Cheat Sheet identifies five essential properties for secure password hashing:

  • Preimage Resistance: Computational infeasibility of deriving the original password from its hash
  • Collision Resistance: Prevention of two different passwords producing identical hash values
  • Deterministic Output: Identical inputs consistently produce identical outputs for verification
  • Avalanche Effect: Single character changes produce completely different hash values
  • Cost Factor Configurability: Adjustable computational requirements as hardware capabilities increase

Tax professionals and financial service providers handling sensitive client data face regulatory requirements under IRS Publication 4557 and the FTC Safeguards Rule that mandate specific technical safeguards including secure password storage implementations.

Key Security Insight

Password hashing algorithms specifically designed for credential protection reduce GPU-based attack efficiency by 1,000-10,000x compared to general-purpose cryptographic hash functions. – OWASP Foundation, Password Storage Cheat Sheet 2026

Argon2: The Password Hashing Competition Winner

Argon2 emerged as the winner of the 2015 Password Hashing Competition, a multi-year evaluation process conducted by cryptographic experts to identify the optimal algorithm for credential protection. The competition assessed submissions against GPU resistance, side-channel attack protection, implementation simplicity, and performance characteristics. Argon2's innovative architecture specifically addresses the parallel computation advantages that undermine earlier algorithms.

Three Variants for Specific Threat Models

Argon2d (Data-Dependent)

Maximizes GPU resistance through data-dependent memory access patterns that prevent parallel optimization. Vulnerable to side-channel timing attacks in shared computing environments.

Argon2i (Independent)

Uses data-independent memory access patterns that eliminate side-channel timing vulnerabilities. Suitable for environments where attackers may observe cache timing or memory access patterns.

Argon2id (Hybrid Recommended)

Combines both approaches—first half uses Argon2i for side-channel resistance, second half uses Argon2d for maximum GPU protection. OWASP recommends this variant for general password storage applications.

The memory parameter (m) represents the primary defense mechanism against parallel attacks. Argon2 fills the specified memory allocation with pseudorandom data derived from the password, then performs multiple passes through this memory in a sequence determined by previous values. Attackers attempting parallel brute-force must allocate the full memory amount for each concurrent attempt, creating linear cost scaling that eliminates GPU efficiency advantages.

Implementation Across Programming Languages

Modern frameworks include native Argon2 support or well-maintained libraries:

  • PHP 7.2+: Native password_hash() function with PASSWORD_ARGON2ID constant
  • Python: argon2-cffi library provides PHC string format compatibility
  • Node.js: argon2 npm package with native binding performance
  • .NET Core: Konscious.Security.Cryptography.Argon2 NuGet package
  • Java: de.mkammerer:argon2-jvm with JNA-based native calls

All implementations should output PHC string format for portability: $argon2id$v=19$m=131072,t=3,p=2$saltbase64$hashbase64. This format encodes algorithm variant, version, parameters, salt, and hash in a single string suitable for database storage.

bcrypt: Battle-Tested Algorithm for Legacy Compatibility

Despite its 1999 origin, bcrypt remains among the best password hashing algorithms for applications requiring proven stability and broad platform support. Designed by Niels Provos and David Mazières based on the Blowfish cipher, bcrypt's architecture incorporates automatic salt generation and exponentially scalable work factors that maintain effectiveness as hardware capabilities increase.

Core Security Mechanisms

Expensive Key Schedule

Derives encryption keys through 4,096 rounds of Blowfish key expansion, consuming approximately 4 KB of fast RAM. This memory requirement creates cache contention on GPUs attempting parallel operations.

Automatic Salt Integration

Generates 128-bit cryptographically random salts automatically, eliminating rainbow table attacks without additional implementation effort.

Exponential Cost Factor

Work parameter ranges from 4-31, with each increment doubling computation time. Cost factor 12 requires 4,096 iterations; factor 13 requires 8,192 iterations.

72-Byte Input Limit

Truncates passwords longer than 72 bytes, which paradoxically prevents certain denial-of-service attacks based on algorithmic complexity.

The pre-hashing recommendation addresses bcrypt's 72-byte limitation while maintaining security. Hash the password with SHA-256, then encode the 32-byte output as hexadecimal (64 characters) before passing to bcrypt. This approach ensures consistent input length while preserving the original password's entropy. Note that some legacy implementations may handle this incorrectly, so thorough testing is essential.

Despite Argon2's technical superiority, bcrypt suits specific scenarios: Legacy System Integration, Embedded Systems with resource constraints, Regulatory Requirements, and Gradual Migration scenarios. Organizations using bcrypt should document migration timelines toward Argon2 and implement monitoring for work factor adequacy. Tax preparation firms handling IRS Publication 1075 covered data must ensure password hashing meets federal security standards outlined in their Written Information Security Plan (WISP).

scrypt: Memory-Hard Pioneer with Proven Track Record

Colin Percival designed scrypt in 2009 as the first practical memory-hard key derivation function, introducing concepts now standard in modern password hashing. The algorithm generates large pseudorandom arrays requiring sustained memory access throughout computation, creating cost barriers for parallel GPU and ASIC attacks. While Argon2 has superseded scrypt for most new implementations, scrypt's decade-plus deployment history demonstrates its security effectiveness.

Memory-Hardness Implementation

1

PBKDF2-HMAC-SHA256 Initialization

Derives initial keying material using standard PBKDF2 with configurable iteration count

2

ROMix Function

Generates sequential array of N 128-byte blocks through iterative mixing, storing each in memory. Second pass randomly accesses these blocks in sequence determined by previous output. This data dependency prevents parallel computation optimization.

3

PBKDF2 Finalization

Processes ROMix output through final PBKDF2 iteration to produce hash output

The ROMix function's sequential memory access requirement means attackers cannot trade computation time for reduced memory usage—both resources remain mandatory, eliminating the time-memory trade-off optimization available against earlier algorithms.

PBKDF2: Standards-Compliant Option for Regulated Environments

PBKDF2 (Password-Based Key Derivation Function 2) holds unique status as a NIST-approved algorithm specified in FIPS 140-2 cryptographic module requirements. This standards approval makes PBKDF2 mandatory for certain government and highly regulated industry applications despite its technical limitations compared to memory-hard alternatives. Tax professionals working with IRS e-file systems may encounter PBKDF2 requirements in federal authentication frameworks.

PBKDF2 Minimum Iteration Counts

FeatureHash FunctionMinimum IterationsRecommendedRecommended Iterations
PBKDF2-HMAC-SHA256
PBKDF2-HMAC-SHA512

The absence of memory-hardness represents PBKDF2's primary security weakness. Modern GPUs execute HMAC operations extremely efficiently through massive parallelization—a single high-end GPU can test millions of PBKDF2 hashes per second even with high iteration counts. This computational efficiency gap compared to Argon2 or bcrypt necessitates substantially higher iteration counts to achieve equivalent security, creating performance trade-offs.

PBKDF2 suits specific scenarios where its standardization provides value: FIPS 140-2 Compliance, Hardware Security Modules, Key Derivation, and Cross-Platform Compatibility. Organizations should document justification when selecting PBKDF2 over Argon2, noting specific regulatory or technical constraints that mandate this choice. Financial services firms must align password hashing with Gramm-Leach-Bliley Act requirements and FTC Safeguards Rule technical standards.

Implementation Best Practices for Production Systems

Technical algorithm selection represents only one component of secure password storage. Implementation quality determines whether theoretical security properties translate to actual protection.

Salt Generation and Management

1

Cryptographic Randomness

Use operating system-provided CSPRNGs (Cryptographically Secure Pseudo-Random Number Generators) such as /dev/urandom, CryptGenRandom(), or language-specific secure random functions

2

Unique Per Password

Generate new salt for every password hash, including password changes for existing accounts

3

Adequate Length

Minimum 16 bytes (128 bits), recommended 32 bytes (256 bits) for maximum preimage resistance

4

Storage Alongside Hash

Salts are not secret values—store in the same database field or adjacent column using standard encoding (base64 or hexadecimal)

Migration Strategies for Algorithm Upgrades

Transitioning from weak to strong algorithms requires careful planning since password hashes cannot be reversed:

  • Transparent Re-hashing: Upon successful authentication using the old algorithm, immediately re-hash the password with the new algorithm and update the database. Mark records with algorithm version identifiers to track migration progress.
  • Hybrid Storage: For limited transition periods, support multiple algorithms simultaneously with version prefixes in stored hashes: v2:$argon2id$... vs v1:$2b$...
  • Gradual Rollout: Implement new algorithm for new accounts first, then migrate active users through transparent re-hashing, then address inactive accounts
  • Mandatory Reset: For critical security improvements (MD5 to Argon2), consider forced password reset for all users with communication explaining security benefits

Constant-Time Comparison

Hash verification must use constant-time comparison functions to prevent timing attacks. Never use string equality operators, use crypto libraries like crypto.timingSafeEqual() (Node.js), hmac.compare_digest() (Python), or hash_equals() (PHP), and verify the full hash output.

Rate Limiting and Account Lockout

Login Attempt Limits

Maximum 5 failed attempts per account per 15-minute window

Progressive Delays

Exponentially increasing delays after each failed attempt (1s, 2s, 4s, 8s, 16s)

IP-Based Throttling

Limit total authentication attempts per source IP to prevent distributed attacks

CAPTCHA Integration

Require human verification after 3 failed attempts

MFA reduces password compromise impact by requiring additional verification. Organizations handling sensitive data should implement mandatory multi-factor authentication for all accounts, including TOTP Authenticators, Hardware Tokens, Push Notifications, and SMS Backup options.

Organizations implementing comprehensive security should also consider managed detection and response solutions as part of defense-in-depth strategies.

Frequently Asked Questions

Argon2id represents the most secure password hashing algorithm for general-purpose applications in 2026. As the winner of the Password Hashing Competition, Argon2id combines memory-hard operations requiring 64-128+ MiB of RAM per hash with hybrid data-dependent and data-independent modes that resist both GPU attacks and side-channel timing analysis. OWASP recommends Argon2id with minimum 19 MiB memory and 2 iterations, though security-conscious implementations should use 128 MiB memory and 3-5 iterations for maximum protection against modern attack methods including cloud-scale distributed cracking and AI-enhanced password guessing.

Yes, bcrypt remains secure for password storage when properly configured with cost factor 13-14, which produces approximately 250-500ms computation time on current server hardware. While Argon2 provides superior GPU resistance through larger memory requirements, bcrypt's 4KB memory footprint still creates cache contention issues that reduce GPU cracking efficiency significantly compared to non-memory-hard algorithms. Organizations using bcrypt should implement transparent re-hashing migration toward Argon2 and annually increase the cost factor to maintain consistent security as hardware capabilities improve. Tax professionals handling sensitive client data under FTC Safeguards Rule requirements should document their algorithm selection and migration timeline in their Written Information Security Plan.

SHA-256 and SHA-512 are cryptographic hash functions designed for speed and data integrity verification, not password protection. Modern GPUs can compute billions of SHA-256 hashes per second, making brute-force attacks trivially fast even against complex passwords. Password-specific algorithms like Argon2, bcrypt, and scrypt implement deliberate computational slowdowns and memory requirements that reduce attack speed by factors of 1,000-10,000x. SHA-256 remains appropriate for digital signatures and data verification, but password storage requires purpose-built algorithms with configurable cost factors and GPU resistance. The NIST Special Publication 800-63B explicitly recommends memory-hard password hashing functions over general-purpose cryptographic hashes.

Organizations should review and increase password hashing algorithm parameters annually to compensate for hardware performance improvements following Moore's Law. Typical adjustments include increasing Argon2 iterations by 1, incrementing bcrypt cost factor by 1, or doubling PBKDF2 iteration count. Each adjustment should maintain target authentication time between 200-300ms for standard applications or 500-1000ms for high-security environments. Implement monitoring that alerts when authentication time drops below threshold, indicating parameter degradation. Major algorithm migrations (MD5 to Argon2) should occur immediately upon identifying legacy implementations. Tax preparation firms must document parameter review procedures in their WISP to satisfy IRS Publication 4557 and FTC Safeguards Rule annual risk assessment requirements.

Argon2d uses data-dependent memory access patterns that maximize GPU resistance but create vulnerability to side-channel timing attacks. Argon2i uses data-independent memory access that eliminates timing attack vectors but provides slightly reduced GPU resistance. Argon2id combines both approaches in a hybrid design—the first half uses Argon2i for side-channel protection, while the second half uses Argon2d for maximum GPU resistance. OWASP and security experts recommend Argon2id as the default choice for password hashing, as it provides balanced protection against both attack categories relevant to authentication systems. Financial services organizations handling sensitive customer data under GLBA and FTC Safeguards Rule should prioritize Argon2id for its comprehensive security properties.

No, salts are not secret values and do not require confidentiality protection beyond standard database access controls. Salts serve to ensure identical passwords produce different hashes across users, eliminating rainbow table attacks and forcing attackers to crack each password individually. Salts can be stored in the same database field as the hash (encoded in PHC string format) or adjacent columns. The password itself remains the only secret value in the authentication system. However, attackers gaining database access can attempt brute-force cracking, which proper algorithm selection (Argon2, bcrypt) defends against by making each cracking attempt computationally expensive. Organizations should implement database encryption, access logging, and intrusion detection as complementary controls documented in their Written Information Security Plan.

Yes, transparent re-hashing enables gradual migration without forcing password resets. Implement version identifiers in stored hashes to distinguish algorithms (e.g., v1: prefix for PBKDF2, v2: for Argon2). During authentication, verify the password using the algorithm indicated by the version identifier. Upon successful verification, immediately re-hash the password using Argon2, update the database with the new hash and version identifier, then complete the login process. This approach migrates active users organically over time. After 6-12 months, consider forced password reset for remaining inactive accounts to complete the migration. Document the migration timeline and completion status in your security incident response plan and WISP annual review.

Argon2 memory requirements scale linearly with concurrent authentication operations. For recommended 128 MiB memory parameter, each simultaneous hash computation requires 128 MiB RAM. A server handling 10 concurrent authentications needs 1.28 GB available memory for Argon2 operations. CPU utilization depends on iteration count and parallelism parameters—typical configurations (t=3, p=2) consume 2 CPU cores per operation for 200-300ms. Production capacity planning should measure concurrent authentication peaks and allocate resources accordingly. Most modern server configurations easily accommodate Argon2 requirements, with memory being the primary scaling consideration rather than CPU. Cloud-based authentication systems can scale horizontally by adding instances as user base grows.

Strengthen Your Cybersecurity Posture

Schedule a free consultation to discuss your cybersecurity needs and build a protection plan.

Share

Share on X
Share on LinkedIn
Share on Facebook
Send via Email
Copy URL
(800) 492-6076
Share

Schedule

Want personalized advice?

Our cybersecurity experts can help you implement these best practices. Free consultation.

Still Have Questions? We're Happy to Chat.

Book a free 15-minute call with our team. No sales pitch, no jargon — just straight answers about staying safe online.