Modern password hashing for your software and your servers
Project description
bcrypt
Modern password hashing for your software and your servers
Installation
To install bcrypt, simply:
$ pip install bcrypt
Usage
Basic
Hashing and then later checking that a password matches the previous hashed password is very simple:
>>> import bcrypt
>>> password = b"super secret password"
>>> # Hash a password for the first time, with a randomly-generated salt
>>> hashed = bcrypt.hashpw(password, bcrypt.gensalt())
>>> # Check that a unhashed password matches one that has previously been
>>> # hashed
>>> if bcrypt.hashpw(password, hashed) == hashed:
... print("It Matches!")
... else:
... print("It Does not Match :(")
Adjustable Work Factor
One of bcrypt’s features is an adjustable logarithmic work factor. To adjust the work factor merely pass the desired number of rounds to bcrypt.gensalt(rounds=12) which defaults to 12):
>>> import bcrypt
>>> password = b"super secret password"
>>> # Hash a password for the first time, with a certain number of rounds
>>> hashed = bcrypt.hashpw(password, bcrypt.gensalt(14))
>>> # Check that a unhashed password matches one that has previously been
>>> # hashed
>>> if bcrypt.hashpw(password, hashed) == hashed:
... print("It Matches!")
... else:
... print("It Does not Match :(")
Compatibility
This library should be compatible with py-bcrypt and it will run on Python 2.6+, 3.2+, and PyPy.
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
bcrypt-1.1.0.tar.gz
(39.5 kB
view hashes)
Built Distributions
bcrypt-1.1.0-cp34-none-win32.whl
(56.5 kB
view hashes)
bcrypt-1.1.0-cp33-none-win32.whl
(56.5 kB
view hashes)
bcrypt-1.1.0-cp32-none-win32.whl
(56.5 kB
view hashes)
bcrypt-1.1.0-cp27-none-win32.whl
(56.5 kB
view hashes)
bcrypt-1.1.0-cp26-none-win32.whl
(56.8 kB
view hashes)
Close
Hashes for bcrypt-1.1.0-cp34-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8b81e9c76abae86a2ed361c9600bd788ea3451b7180d6a2b104f7518f1d749ca |
|
MD5 | ad3d83d1378e25323b0774799c0ef935 |
|
BLAKE2b-256 | 4aaa00cd3458d9a6c9e9c5fa7b254376cd2756acb038412fa8b288264eefd116 |
Close
Hashes for bcrypt-1.1.0-cp34-none-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2d13a699f33c8d7d05510a680a1ed539028584b29c3f59dcb96be8340a9647a0 |
|
MD5 | 026fa362f7379c58c084749ff0079b35 |
|
BLAKE2b-256 | efd4b4247014579e9ca4fbbe04384a8e10a1a28632413a3e74576e44c5278ff5 |
Close
Hashes for bcrypt-1.1.0-cp33-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ab4f1a462568766cad174c2a7d0c7295e9e80387a20120a04d7d7ced6e8f3a41 |
|
MD5 | b63c2caaf66fb59816ae188be8b8a7f7 |
|
BLAKE2b-256 | a0aa402ce337251368ef15ee81a3d903ddf4d763702f1ffbfd0e0ef128a9188f |
Close
Hashes for bcrypt-1.1.0-cp33-none-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4d4fe65905949a501c54401966be69f7eac4921f29fe2b6b73e89e66b1f7a2f5 |
|
MD5 | f4cd7bb3477c303587c88056e01408c5 |
|
BLAKE2b-256 | da097256cfc0234217c80c41e247b702680122f240322b1a5d366daaecb73cf7 |
Close
Hashes for bcrypt-1.1.0-cp32-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | da994cee769d779fbd8e1868499e3bb1cad229d7bcc4cb118073b65964c65a76 |
|
MD5 | d43ede74894bcecc97307429cc9a8408 |
|
BLAKE2b-256 | d99d6b063bd41b12721c9d07a085e33156375892f92dc302e44844084acbb694 |
Close
Hashes for bcrypt-1.1.0-cp32-none-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7b7ccef1dd180f036fe6a905108494cc3c5a43e5f745f249ffc17449dc0345ac |
|
MD5 | 60c311589b9dd0bc683f1b46e0af219d |
|
BLAKE2b-256 | 81f1c30b39506ea0419f435f848001acf80019988df60293c7c9130396372523 |
Close
Hashes for bcrypt-1.1.0-cp27-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f5745e6ce86e4df2521b6c2eb2781e273e6a917cd4998977460b4ffd56a1ebcb |
|
MD5 | 8e3da550ffb00c6e00a60971c7abee6e |
|
BLAKE2b-256 | 882a9d4ffc5b522a30d13198cd929784e72cdf614902a8ecdfbd4ed32f87427f |
Close
Hashes for bcrypt-1.1.0-cp27-none-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1fe406711419ba174f54aaa2d177f6454f00cdcd97d303624abc5f695ae6151c |
|
MD5 | 501a415039a5d58095f3ad843901f294 |
|
BLAKE2b-256 | 9479fd47fc35f888a3abe47c3d0a1006866a4525736f96b9b8f6ceab13d7d227 |
Close
Hashes for bcrypt-1.1.0-cp26-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 832652fba6f93f3e9778ec0c7e483ee96e607fcfca3567d2f8e147c8bdb0fdd9 |
|
MD5 | 0acf9eb32338a2fb7bb8aa1e6ac7364b |
|
BLAKE2b-256 | d336074d209c7fc6952c913b3fc9deb2c3b8ddf7434cee776b3f5ca363b17599 |
Close
Hashes for bcrypt-1.1.0-cp26-none-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 76f4ed72a3237fe5c9b9da2704af63a35c8e8934ffbf589132f80b6538a0eca2 |
|
MD5 | 45aad7f7ca7a1168043940e4108fe7bf |
|
BLAKE2b-256 | e219cec3ca37544d944aaa5dfd231f14657ba5b1cb24891e2cfb390eaeedf345 |