Hashes/Cripto
Argon2 Hash + Verify
Hashea contraseñas con Argon2 (ganador de la Password Hashing Competition, RFC 9106) — variantes d/i/id, con verificación contra un hash existente.
Argon2 is the Password Hashing Competition winner and the algorithm recommended in RFC 9106 for hashing passwords. Unlike bcrypt, it deliberately demands a lot of memory, not just CPU time, which makes attacks on specialized hardware (GPUs, ASICs) much harder.
How to use it
- Hash: enter a password, pick a variant (Argon2d, Argon2i, or Argon2id), and set the parameters (memory, iterations, parallelism) to get a hash.
- Verify: paste a password and an existing Argon2 hash to check whether they match, without hashing manually yourself.
- Argon2id is the recommended default for most applications — it combines the strengths of Argon2i and Argon2d.
Common uses
- Checking that a backend generates correct Argon2 hashes with the expected parameters before a release.
- Tuning memory and iteration parameters to fit within a server's response-time budget (typically 250-500ms).
- Comparing Argon2 against bcrypt or PBKDF2 when choosing an algorithm for a new project.
Things to keep in mind
The memory parameter is Argon2's main defense: the more memory hashing requires, the more expensive it is for an attacker to parallelize an attack on a GPU with limited fast memory per chip.
Argon2id is recommended for most cases: Argon2i resists side-channel attacks better, Argon2d resists GPU attacks better, and id combines both approaches.
Preguntas frecuentes
¿Por qué se recomienda Argon2 frente a hashes antiguos como MD5 o SHA-256 para contraseñas?
Argon2 es deliberadamente lento y exige mucha memoria, lo que hace mucho más costoso el fuerza bruta y el crackeo con GPU/ASIC, a diferencia de hashes rápidos de propósito general como MD5 o SHA-256, inadecuados para almacenar contraseñas.
¿Qué controlan los parámetros de memoria, iteraciones y paralelismo?
El coste de memoria fija cuánta RAM requiere cada intento de hash, las iteraciones controlan cuántas pasadas se ejecutan, y el paralelismo fija el número de hilos — aumentar cualquiera eleva el coste de crackear a costa de un hash más lento.
¿Qué variante de Argon2 debería usar: d, i o id?
Argon2id es la recomendación por defecto para hashear contraseñas, ya que combina la resistencia de Argon2i a ataques de canal lateral con la resistencia de Argon2d al crackeo por GPU.
¿De dónde viene Argon2 como estándar?
Argon2 ganó la Password Hashing Competition de 2015 — un concurso abierto de criptógrafos cuyo objetivo era encontrar el mejor algoritmo para hashear contraseñas. Desde entonces, OWASP lo recomienda como elección prioritaria sobre bcrypt.
¿El parámetro de paralelismo solo acelera el hasheo?
No, ese mismo parámetro también acelera el fuerza bruta para un atacante con hardware multinúcleo, por lo que el paralelismo conviene ajustarlo según el número real de núcleos del servidor, sin aumentarlo sin necesidad.