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.
Security
bcrypt follows the same security policy as cryptography, if you identify a vulnerability, we ask you to contact us privately.
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
Hashes for bcrypt-1.1.1-cp34-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cf6d8273b8a2ddf36a9e0486ae5b42aa616fb357de20957645beb96b391b12cf |
|
MD5 | c0f13343cdb46ffaf4e962fc2a453008 |
|
BLAKE2b-256 | 9b88350f66577458f52ff32d9e1ed313e65cc4bd4bd807b42cf75e5f841a2ae5 |
Hashes for bcrypt-1.1.1-cp34-none-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e6809d5106a99a6c623a90831f3fb37443329fb30c5230a4a969ac3ab070f960 |
|
MD5 | 4b5bd854a51ce29e0cf5bd7e115d4e15 |
|
BLAKE2b-256 | 1849277f51bc4586da5aaf339d9cf5e5d28494f0bd163c14a0cc02359953767e |
Hashes for bcrypt-1.1.1-cp33-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4241d9787860f53ad2c7eedc974b90fd59626114b79e549f3b17da725c96349d |
|
MD5 | bd4a19bd34819368c50ce2ce1ec67548 |
|
BLAKE2b-256 | e29d5fb474ffc766346cee4abf89fa3237184e2285243d02b5ca6accabaa9b7e |
Hashes for bcrypt-1.1.1-cp33-none-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 50f2fdc3ffedc308de33d85550ef8e49a4b0ec653178030ade2532de69decde7 |
|
MD5 | 092ca5731a285ab39e591e70991ceab8 |
|
BLAKE2b-256 | 619ddaa779187a71b63c5606986e96e863b8f1957464dfbb736a225818f16563 |
Hashes for bcrypt-1.1.1-cp32-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ea26b68c8d5628831a7167ba4ce2a2b0a763d9a29b07a0b04f7e535f467af959 |
|
MD5 | a1ac0a05c5ff2131e021bad0e885b321 |
|
BLAKE2b-256 | 8a3d298952e5d868d7ac472ae5e07d0eb4e726595c9789967eb3a5692ed0aaa2 |
Hashes for bcrypt-1.1.1-cp32-none-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a71c7e4ca1de4c62094330a6dd2d3b0eca53c60c0d8882e4fc60f9225d26e282 |
|
MD5 | 6a94781d8f0b47c37117c71c7493218d |
|
BLAKE2b-256 | b98d3a4c705055322c2096eca9c23fd760e2a7457da9238b8895694677ae2359 |
Hashes for bcrypt-1.1.1-cp27-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c50e70a2f92ab5e7037afb241463f0939b358982ffbfa19783d14d00ad75feb8 |
|
MD5 | 0cb90404f79bd9898eabf389f24cb0a4 |
|
BLAKE2b-256 | 001a6bc9860f53cac5878634a966624755c191c9c96cbc83eac99a6ab6828e2c |
Hashes for bcrypt-1.1.1-cp27-none-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b54cb7d7003f4660bcc122fab6d2398ccfa51db05e5c57570fc254f213fd2b39 |
|
MD5 | b6ed13578bbd6275f603ba071249f110 |
|
BLAKE2b-256 | a381ab82f9c29a50603c0bb52778e81a906b6b7df80e7c3f12ceba1904bb6f7a |
Hashes for bcrypt-1.1.1-cp26-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f0b2e7b639e3ff29d23ceddaa8a243ac48942e3e8314466a3026e7d4cdb7f705 |
|
MD5 | a41a3ae6f7c3e97ed415eead709d5227 |
|
BLAKE2b-256 | 9f1dfcebc779f783fc9a8dece2c36e61e7be5fd3c75f501f68cd7a5c954dd5cd |
Hashes for bcrypt-1.1.1-cp26-none-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6ba71375e13ae9d0556e64d9bbdc34c42ea28206273a76eaffc857e27f283444 |
|
MD5 | a8ffe042f3a487f1b430e61eb05fb640 |
|
BLAKE2b-256 | f9893247eba21f232c8ecdc95ceb487543774fa29197ff157f3222e4f1c7eeb5 |