Argon2 for Python

hash, hashing, password, security, argon2, cffi, password-hash, python
pip install argon2-cffi==23.1.0


argon2-cffi: Argon2 for Python

Documentation License: MIT CII Best Practices PyPI version Downloads / Month

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
>>> ph.verify(hash, "correct horse battery staple")
>>> ph.check_needs_rehash(hash)
>>> ph.verify(hash, "Tr0ub4dor&3")
Traceback (most recent call last):
argon2.exceptions.VerifyMismatchError: The password does not match the supplied hash

Project Links


argon2-cffi is maintained by Hynek Schlawack.

The development is kindly supported by my employer Variomedia AG, argon2-cffi Tidelift subscribers, and my amazing GitHub Sponsors.

argon2-cffi for Enterprise

Available as part of the Tidelift Subscription.

The maintainers of argon2-cffi and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open-source packages you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact packages you use. Learn more.