Argon2 for Python
Maintained. Last release 18 months ago, commits in 10 of the last 26 weeks. Weaker on recent releases and release cadence.
pip install argon2-cffiargon2-cffi: Argon2 for Python
Argon2 won the Password Hashing Competition and argon2-cffi is the simplest way to use it in Python:
>>> from argon2 import PasswordHasher
>>> ph = PasswordHasher()
>>> hash = ph.hash("correct horse battery staple")
>>> hash # doctest: +SKIP
'$argon2id$v=19$m=65536,t=3,p=4$MIIRqgvgQbgj220jfp0MPA$YfwJSVjtjSU0zzV/P3S9nnQ/USre2wvJMjfCIjrTQbg'
>>> ph.verify(hash, "correct horse battery staple")
True
>>> ph.check_needs_rehash(hash)
False
>>> ph.verify(hash, "Tr0ub4dor&3")
Traceback (most recent call last):
...
argon2.exceptions.VerifyMismatchError: The password does not match the supplied hash
Project Links
- PyPI
- GitHub
- Documentation
- Changelog
- Funding
- The low-level Argon2 CFFI bindings are maintained in the separate argon2-cffi-bindings project.
Release Information
Added
- Official support for Python 3.13 and 3.14. No code changes were necessary.
Removed
- Python 3.7 is not supported anymore. #186
Changed
-
argon2.PasswordHasher.check_needs_rehash()now also accepts bytes like the rest of the API. #174 -
Improved parameter compatibility handling for Pyodide / WebAssembly environments. #190