Skip to content
Thin wrapper around the bcrypt library.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


Wrapper around python-bcrypt to provide simple access to the future-proof BCrypt algorithms, for password hashing.

Generating a password hash

>>> from bkrypt import Password
>>> p = Password.create('my secret password')
>>> print(p)

To get the hash string out, use p.hash or str(p).

Checking password correctness

>>> from bkrypt import Password
>>> p = Password('$2a$04$I2KuvSCq4pF/xJeSieLcsO.xs204lqy1IuakktiI/PZxv7OwIAoWS')
>>> p == 'foo'
>>> p == 'my secret password'

About the hashes

Generating stronger hashes

Note that generating a password hash for the same password will result in different hashes every time:

>>> for i in range(0, 3):
...     p = Password.create('my secret password')
...     print(p)

Generating stronger hashes

To generate stronger hashes, use increased strength (12 is default). Both generating and checking then takes significantly longer, by the very design of the BCrypt algorithm, that is.

>>> p = Password.create('my secret password', strength=15)


The usual stuff.

$ pip install bkrypt
Something went wrong with that request. Please try again.