Hashe/Krypto
Argon2 Hash + Verify
Hashuj hasła za pomocą Argon2 (zwycięzca Password Hashing Competition, RFC 9106) — warianty d/i/id, z weryfikacją względem istniejącego hasha.
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.
Artykuł o tym narzędziu: Argon2: dlaczego ten algorytm wygrał konkurs na haszowanie haseł
Najczęstsze pytania
Dlaczego Argon2 jest zalecany zamiast starszych hashy, takich jak MD5 czy SHA-256, do haseł?
Argon2 jest celowo powolny i wymaga dużo pamięci, co znacznie podnosi koszt ataków brute-force oraz łamania z użyciem GPU/ASIC — w przeciwieństwie do szybkich uniwersalnych hashy jak MD5 czy SHA-256, nieodpowiednich do przechowywania haseł.
Co kontrolują parametry pamięci, iteracji i równoległości?
Koszt pamięci określa, ile RAM-u wymaga każda próba hashowania, iteracje kontrolują liczbę przebiegów, a równoległość liczbę wątków — zwiększenie któregokolwiek podnosi koszt łamania, ale spowalnia hashowanie.
Którego wariantu Argon2 użyć — d, i czy id?
Argon2id to zalecany domyślny wariant do hashowania haseł, ponieważ łączy odporność Argon2i na ataki kanałem bocznym z odpornością Argon2d na łamanie GPU.
Skąd wziął się Argon2 jako standard?
Argon2 wygrał Password Hashing Competition w 2015 roku — otwarty konkurs kryptografów, którego celem było znalezienie najlepszego algorytmu do haszowania haseł. Od tego czasu OWASP zaleca go jako priorytetowy wybór nad bcrypt.
Czy parametr równoległości tylko przyspiesza haszowanie?
Nie, ten sam parametr tak samo przyspiesza łamanie hasła atakującemu dysponującemu wielordzeniowym sprzętem, dlatego równoległość warto dobierać odpowiednio do rzeczywistej liczby rdzeni serwera, a nie zwiększać bez potrzeby.