Argon2 for Python
Project description
argon2-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
Removed
- Python 3.6 is not supported anymore.
Deprecated
-
The
InvalidHash
exception is deprecated in favor ofInvalidHashError
. No plans for removal currently exist and the names can (but shouldn't) be used interchangeably. -
argon2.hash_password()
,argon2.hash_password_raw()
, andargon2.verify_password()
that have been soft-deprecated since 2016 are now hard-deprecated. They now raiseDeprecationWarning
s and will be removed in 2024.
Added
-
Official support for Python 3.11 and 3.12. No code changes were necessary.
-
argon2.exceptions.InvalidHashError
as a replacement forInvalidHash
. -
salt parameter to
argon2.PasswordHasher.hash()
to allow for custom salts. This is only useful for specialized use-cases -- leave it on None unless you know exactly what you are doing. #153
Credits
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file argon2_cffi-23.1.0.tar.gz
.
File metadata
- Download URL: argon2_cffi-23.1.0.tar.gz
- Upload date:
- Size: 42.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/4.0.2 CPython/3.11.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 879c3e79a2729ce768ebb7d36d4609e3a78a4ca2ec3a9f12286ca057e3d0db08 |
|
MD5 | 7371c126f21a895b33c4fe7e00ac6fc1 |
|
BLAKE2b-256 | 31fa57ec2c6d16ecd2ba0cf15f3c7d1c3c2e7b5fcb83555ff56d7ab10888ec8f |
Provenance
File details
Details for the file argon2_cffi-23.1.0-py3-none-any.whl
.
File metadata
- Download URL: argon2_cffi-23.1.0-py3-none-any.whl
- Upload date:
- Size: 15.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/4.0.2 CPython/3.11.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c670642b78ba29641818ab2e68bd4e6a78ba53b7eff7b4c3815ae16abf91c7ea |
|
MD5 | a40a4892f0750b393a6cdc64901d58cb |
|
BLAKE2b-256 | a46ae8a041599e78b6b3752da48000b14c8d1e8a04ded09c88c714ba047f34f5 |