Argon2 Cost & Memory Calculator
Calibrate Argon2id, Argon2i, and Argon2d parameters. Balance server response latency against memory hardness to defeat brute-force GPU and ASIC cracking attacks.
Forcing high RAM makes GPU cluster attacks economically unfeasible.
Number of linear passes over the allocated memory matrix.
Number of concurrent execution lanes (compute threads).
// npm install argon2
import argon2 from 'argon2';
const hash = await argon2.hash('user_password', {
type: argon2.argon2id,
memoryCost: 65536, // 64 MiB in KiB
timeCost: 3,
parallelism: 4,
hashLength: 32,
saltLength: 16,
});
// Verification:
const isValid = await argon2.verify(hash, 'user_password');Why Argon2id Is the Gold Standard in Modern Password Hashing
The Evolution from bcrypt & PBKDF2 to Memory-Hard Functions
Legacy password hashing algorithms like PBKDF2 and bcrypt require very little memory (PBKDF2 uses negligible RAM; bcrypt caps out at just 4 KiB).
Because modern GPUs, FPGAs, and ASICs contain thousands of compact parallel compute cores with high memory bandwidth, attackers can compute hundreds of millions of bcrypt or PBKDF2 hashes per second. Argon2 requires tens or hundreds of megabytes of RAM per hash calculation, making parallel hardware attacks financially and physically prohibitive.
Differences Between Argon2d, Argon2i, and Argon2id (RFC 9106)
Argon2 has three official variants designed for different threat models:
- Argon2d: Data-dependent memory access. Highest resistance against GPU cracking, but vulnerable to side-channel cache-timing attacks. Best for cryptocurrencies and offline storage where timing leaks are not observable.
- Argon2i: Data-independent memory access. Completely immune to side-channel cache-timing attacks, but requires more passes to resist GPU cracking.
- Argon2id (Recommended): Hybrid approach. Starts with data-independent passes to thwart side-channel analysis, then continues with data-dependent passes to maximize GPU hardness. Recommended by RFC 9106 and OWASP for all web applications.