Skip to main content

The secure Argon2 password hashing algorithm.

Project description

Documentation License: MIT PyPI version Downloads / Month

Argon2 won the Password Hashing Competition and argon2-cffi is the simplest way to use it in Python and PyPy:

>>> 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 Information

argon2-cffi is available from PyPI, the documentation lives at Read the Docs, the code on GitHub. The low-level Argon2 CFFI bindings are maintained in the separate project argon2-cffi-bindings.

It targets Python 3.6 and newer, and PyPy3. The last version that works with Python 2.7 is 20.1.0, and the last version that works with Python 3.5 is 21.1.0.

argon2-cffi implements Argon2 version 1.3, as described in Argon2: the memory-hard function for password hashing and other applications.

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

argon2-cffi-21.2.0.tar.gz (42.4 kB view hashes)

Uploaded Source

Built Distribution

argon2_cffi-21.2.0-py3-none-any.whl (14.3 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page