The secure Argon2 password hashing algorithm.
Project description
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("secret")
>>> hash # doctest: +SKIP
'$argon2i$m=512,t=2,p=2$c29tZXNhbHQ$2IdoNVglVTxb9w4YVJqW8w'
>>> ph.verify(hash, "secret")
True
>>> ph.verify(hash, "wrong")
Traceback (most recent call last):
...
argon2.exceptions.VerificationError: Decoding failed
argon2_cffi’s documentation lives at Read the Docs, the code on GitHub. It’s rigorously tested on Python 2.6, 2.7, 3.3+, and PyPy.
Frequently Asked Questions
- I’m using bcrypt/scrypt/PBKDF2, do I need to migrate?
Using password hashes that aren’t memory hard carries a certain risk but there’s no immediate danger or need for action. If however you are deciding how to hash password today, pick Argon2 because it’s a superior, future-proof choice.
But if you already use one of the hashes mentioned in the question, you should be fine for the foreseeable future.
Changelog
Versions are year-based with a strict backward compatibility policy. The third digit is only for regressions.
16.0.0 (2016-01-02)
Vendoring argon2 @ 421dafd2a8af5cbb215e16da5953663eb101d139.
Deprecations:
hash_password(), hash_password_raw(), and verify_password() should not be used anymore. For hashing passwords, use the new argon2.PasswordHasher. If you want to implement your own higher-level abstractions, use the new low-level APIs hash_secret(), hash_secret_raw(), and verify_secret() from the argon2.low_level module. If you want to go really low-level, core() is for you. The old functions will not raise any warnings though and there are no immediate plans to remove them.
Changes:
Add argon2.PasswordHasher. A higher-level class specifically for hashing passwords that also works on Unicode strings.
Add argon2.low_level module with low-level API bindings for building own high-level abstractions.
15.0.1 (2015-12-18)
Vendoring argon2 @ 4fe0d8cda37691228dd5a96a310be57369403a4b.
Changes:
Fix long_description on PyPI.
15.0.0 (2015-12-18)
Vendoring argon2 @ 4fe0d8cda37691228dd5a96a310be57369403a4b.
Changes:
verify_password() doesn’t guess the hash type if passed None anymore. Supporting this resulted in measurable overhead (~ 0.6ms vs 0.8ms on my notebook) since it had to happen in Python. That means that naïve usage of the API would give attackers an edge. The new behavior is that it has the same default value as hash_password() such that verify_password(hash_password(b"password"), b"password") still works.
Conditionally use the SSE2-optimized version of argon2 on x86 architectures.
More packaging fixes. Most notably compilation on Visual Studio 2010 for Python 3.3 and 3.4.
Tweaked default parameters to more reasonable values. Verification should take between 0.5ms and 1ms on recent-ish hardware.
15.0.0b5 (2015-12-10)
Vendoring argon2 @ 4fe0d8cda37691228dd5a96a310be57369403a4b.
Initial work. Previous betas were only for fixing Windows packaging. The authors of argon2 were kind enough to help me to get it building under Visual Studio 2008 that we’re forced to use for Python 2.7 on Windows.
Credits & License
argon2_cffi is maintained by Hynek Schlawack and released under the MIT license.
The development is kindly supported by Variomedia AG.
A full list of contributors can be found in GitHub’s overview.
Vendored Code
Argon2
The original Argon2 repo can be found at https://github.com/P-H-C/phc-winner-argon2/.
Except for the components listed below, the Argon2 code in this repository is copyright (c) 2015 Daniel Dinu, Dmitry Khovratovich (main authors), Jean-Philippe Aumasson and Samuel Neves, and under CC0 license.
The string encoding routines in src/encoding.c are copyright (c) 2015 Thomas Pornin, and under CC0 license.
The BLAKE2 code in src/blake2/ is copyright (c) Samuel Neves, 2013-2015, and under CC0 license.
The authors of Argon2 also were very helpful to get the library to compile on ancient versions of Visual Studio for ancient versions of Python.
The documentation also quotes frequently from the Argon2 paper to avoid mistakes by rephrasing.
msinttypes
In order to be able to compile on Visual Studio 2008 and Visual Studio 2010 which are required for Python 2.6/2.7 and 3.3/3.4 respectively, we also ship two C headers with integer types. They are from the msinttypes project (auto-import on GitHub) and licensed under New BSD:
Copyright (c) 2006-2013 Alexander Chemeris
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
Neither the name of the product nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ‘’AS IS’’ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
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 Distributions
File details
Details for the file argon2_cffi-16.0.0.tar.gz
.
File metadata
- Download URL: argon2_cffi-16.0.0.tar.gz
- Upload date:
- Size: 822.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 109fe8d69f54f5bbd38691bd3decb6fa0b9cef87e3378e1009fce7dbfaec680f |
|
MD5 | de231ab17d9ddd9790a1aab37930cbb4 |
|
BLAKE2b-256 | 0721c023aeb70fe0b2966f4d50a2a9f5d948a7d9039f923c46225b0f39a6123e |
File details
Details for the file argon2_cffi-16.0.0-cp35-none-win_amd64.whl
.
File metadata
- Download URL: argon2_cffi-16.0.0-cp35-none-win_amd64.whl
- Upload date:
- Size: 39.1 kB
- Tags: CPython 3.5, Windows x86-64
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3de0537de4aae372fe6dd6cc8404dff836a88112031ca2b50eab672a867a813a |
|
MD5 | 2acb141f6cfd4b90e9053358bd2e8778 |
|
BLAKE2b-256 | 53f9e98de098bcdea1e00dc7cbbf46ce516b1d010f3b4feff2568b7e6fe0107b |
File details
Details for the file argon2_cffi-16.0.0-cp35-none-win32.whl
.
File metadata
- Download URL: argon2_cffi-16.0.0-cp35-none-win32.whl
- Upload date:
- Size: 36.0 kB
- Tags: CPython 3.5, Windows x86
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 79eae005fa8bcc43ea32bcca34c94e0a58a929419907c49df33919820c1028c1 |
|
MD5 | 400bad44260ecab82716dbed8dada139 |
|
BLAKE2b-256 | 64a6ccddd11a1689d3e2a73b5f33f2ade9d36c83a016d1d255a6d8b618682748 |
File details
Details for the file argon2_cffi-16.0.0-cp35-cp35m-macosx_10_6_intel.whl
.
File metadata
- Download URL: argon2_cffi-16.0.0-cp35-cp35m-macosx_10_6_intel.whl
- Upload date:
- Size: 55.4 kB
- Tags: CPython 3.5m, macOS 10.6+ intel
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a403591068108d4e06c8740d6ba8fb707af4474677f94cf883dd95b0bc2bdcad |
|
MD5 | 33c486a80f42d5f2096ab014153a7dd0 |
|
BLAKE2b-256 | 78c8079de2b7e66f0706f97a9d740dfae384ea495f400b8d54a459a20256b097 |
File details
Details for the file argon2_cffi-16.0.0-cp34-none-win_amd64.whl
.
File metadata
- Download URL: argon2_cffi-16.0.0-cp34-none-win_amd64.whl
- Upload date:
- Size: 35.2 kB
- Tags: CPython 3.4, Windows x86-64
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a5b895b1b5d8354a400c59c069081034ce5e365e83e9a4b3b0454f5d469cd7c3 |
|
MD5 | 292cea45b53d14e1ba74afe23a074006 |
|
BLAKE2b-256 | 49d7b20200716faf657c21b2fe8e652f702b27119c680d46523db7b7e0d0129e |
File details
Details for the file argon2_cffi-16.0.0-cp34-none-win32.whl
.
File metadata
- Download URL: argon2_cffi-16.0.0-cp34-none-win32.whl
- Upload date:
- Size: 34.8 kB
- Tags: CPython 3.4, Windows x86
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | eae8e7e56d03bd453112633444f5da5d81cf4529153e21d8a4f4b954eaa7cd5c |
|
MD5 | 52c1d4515c2b5afebe6a8e6c30201493 |
|
BLAKE2b-256 | af1197386459d504dcda5dbc5180f46aeaf185ef8bef1a4eee230d41fc96778c |
File details
Details for the file argon2_cffi-16.0.0-cp34-cp34m-macosx_10_6_intel.whl
.
File metadata
- Download URL: argon2_cffi-16.0.0-cp34-cp34m-macosx_10_6_intel.whl
- Upload date:
- Size: 55.4 kB
- Tags: CPython 3.4m, macOS 10.6+ intel
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f49a0cc33fb83159f97c48f7320b78417593ab4a37dc279c2847a60e8c093447 |
|
MD5 | 19ed25c7a0da39f48a0660c140906940 |
|
BLAKE2b-256 | bf71f81634d1804f8a50eafc73f8848f914db03c4eff62617a49c7a48d4ae97d |
File details
Details for the file argon2_cffi-16.0.0-cp33-none-win_amd64.whl
.
File metadata
- Download URL: argon2_cffi-16.0.0-cp33-none-win_amd64.whl
- Upload date:
- Size: 35.2 kB
- Tags: CPython 3.3, Windows x86-64
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 91cbbbbc16eedb2d3f3119b5e2f1b9d58dc42128551948eab5ba4d0eab4858b7 |
|
MD5 | afd0b1ec15c7fdd0a2be2aa9365a79db |
|
BLAKE2b-256 | e9dcd4ffe26a7252aa46aceccd7ed277b7d8ad52e0ec12a3036a215053a16483 |
File details
Details for the file argon2_cffi-16.0.0-cp33-none-win32.whl
.
File metadata
- Download URL: argon2_cffi-16.0.0-cp33-none-win32.whl
- Upload date:
- Size: 34.8 kB
- Tags: CPython 3.3, Windows x86
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 776d8fa47e90e0098e94e2c90df0b902e49451d89db72ec6ac044badf0fef55e |
|
MD5 | 4b87181c57d6ff2dc79a7dc01c46e601 |
|
BLAKE2b-256 | 885b77fdb31ff22e4f4e38f3869751b2011da5a5a6167041aeeca0b0ce133100 |
File details
Details for the file argon2_cffi-16.0.0-cp33-cp33m-macosx_10_6_intel.whl
.
File metadata
- Download URL: argon2_cffi-16.0.0-cp33-cp33m-macosx_10_6_intel.whl
- Upload date:
- Size: 55.3 kB
- Tags: CPython 3.3m, macOS 10.6+ intel
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0be1f0a321ce1b678d9fde148ad4d82af67567b6ed42e7cd6d12f4ef48dcf460 |
|
MD5 | 93a135d6660c1f670bbced9687783a10 |
|
BLAKE2b-256 | d62bca5c49349db2a1b1c2a2dbd61eeb92e2d227c85656673813dd1b0a0608a2 |
File details
Details for the file argon2_cffi-16.0.0-cp27-none-win_amd64.whl
.
File metadata
- Download URL: argon2_cffi-16.0.0-cp27-none-win_amd64.whl
- Upload date:
- Size: 35.5 kB
- Tags: CPython 2.7, Windows x86-64
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 678b62d4969d64149a768a4180ce330e71dec42a6c3ce9acdeb581a941e4ae68 |
|
MD5 | 6ad704a1409c2650f29e59330e260fc4 |
|
BLAKE2b-256 | dd8d059505ee740e9147650c3f41923c0dc75b16e75ed1f0b1540ab86a78f290 |
File details
Details for the file argon2_cffi-16.0.0-cp27-none-win32.whl
.
File metadata
- Download URL: argon2_cffi-16.0.0-cp27-none-win32.whl
- Upload date:
- Size: 34.8 kB
- Tags: CPython 2.7, Windows x86
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4708cbd7c9d236364430cba3d159979fb8b27fa47109158373d2506443def9c3 |
|
MD5 | 0cb46461e5abdf1fd7794bba946a5cbc |
|
BLAKE2b-256 | 595879d499c6c099b6e3aaf23dfc6d455b1ae4f843dea5ed7092d58a862795d1 |
File details
Details for the file argon2_cffi-16.0.0-cp27-none-macosx_10_6_intel.whl
.
File metadata
- Download URL: argon2_cffi-16.0.0-cp27-none-macosx_10_6_intel.whl
- Upload date:
- Size: 55.3 kB
- Tags: CPython 2.7, macOS 10.6+ intel
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6354aefbd6955134d9fb048d4e8b3b025af86f20765766a08bdf59c947569e7b |
|
MD5 | 41f245fb512a02de89a32d0bd505d9af |
|
BLAKE2b-256 | 9d905d81681c8f00c917a1f645821ce058b44c49969ba7426d6a22bc1368fae5 |
File details
Details for the file argon2_cffi-16.0.0-cp26-none-win_amd64.whl
.
File metadata
- Download URL: argon2_cffi-16.0.0-cp26-none-win_amd64.whl
- Upload date:
- Size: 35.8 kB
- Tags: CPython 2.6, Windows x86-64
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d16914ee834ec293b440fcc6a31193e61cb472e6f6bb90bea690487fef58c331 |
|
MD5 | 74d3f3f07a80e2700d965abd375415c0 |
|
BLAKE2b-256 | b5f56aef31f3d9c6ffda0b18e0150098155ee7f380f1d34507b0190434832766 |
File details
Details for the file argon2_cffi-16.0.0-cp26-none-win32.whl
.
File metadata
- Download URL: argon2_cffi-16.0.0-cp26-none-win32.whl
- Upload date:
- Size: 35.1 kB
- Tags: CPython 2.6, Windows x86
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 34a42ed57a58e299fe34c32e0b6e8abbb35731b97241cb54e7279d8ebdbfbd31 |
|
MD5 | 31b4ed9497b0b454d5c746d1a46155fd |
|
BLAKE2b-256 | 82bdb54b66fc72df721b0ae16eb2755afaa6f4e299af045f37b789cf4e35cb62 |
File details
Details for the file argon2_cffi-16.0.0-cp26-none-macosx_10_7_intel.whl
.
File metadata
- Download URL: argon2_cffi-16.0.0-cp26-none-macosx_10_7_intel.whl
- Upload date:
- Size: 52.1 kB
- Tags: CPython 2.6, macOS 10.7+ intel
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 720d16d9ddf20aa78dd5be979f39f170cabc36f7f477b110965027eaae4ddfaf |
|
MD5 | f238a5543d64d9c17932db76d16c10ec |
|
BLAKE2b-256 | ac863c85a096aac3023f63cfd293b4ee8651638e258f819041e579e7f29390df |