Skip to main content

Modern password hashing for your software and your servers

Project description

bcrypt

Latest Version https://travis-ci.org/pyca/bcrypt.svg?branch=master

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 :(")

Adjustable Prefix

Another one of bcrypt’s features is an adjustable prefix to let you define what libraries you’ll remain compatible with. To adjust this, pass either 2a or 2b (the default) to bcrypt.gensalt(prefix=b"2b") as a bytes object.

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bcrypt-2.0.0.tar.gz (38.7 kB view details)

Uploaded Source

Built Distributions

bcrypt-2.0.0-cp35-none-win_amd64.whl (21.0 kB view details)

Uploaded CPython 3.5Windows x86-64

bcrypt-2.0.0-cp35-none-win32.whl (19.1 kB view details)

Uploaded CPython 3.5Windows x86

bcrypt-2.0.0-cp34-none-win_amd64.whl (18.7 kB view details)

Uploaded CPython 3.4Windows x86-64

bcrypt-2.0.0-cp34-none-win32.whl (18.3 kB view details)

Uploaded CPython 3.4Windows x86

bcrypt-2.0.0-cp33-none-win_amd64.whl (18.7 kB view details)

Uploaded CPython 3.3Windows x86-64

bcrypt-2.0.0-cp33-none-win32.whl (18.3 kB view details)

Uploaded CPython 3.3Windows x86

bcrypt-2.0.0-cp32-none-win_amd64.whl (18.6 kB view details)

Uploaded CPython 3.2Windows x86-64

bcrypt-2.0.0-cp32-none-win32.whl (18.3 kB view details)

Uploaded CPython 3.2Windows x86

bcrypt-2.0.0-cp27-none-win_amd64.whl (18.7 kB view details)

Uploaded CPython 2.7Windows x86-64

bcrypt-2.0.0-cp27-none-win32.whl (18.3 kB view details)

Uploaded CPython 2.7Windows x86

bcrypt-2.0.0-cp26-none-win_amd64.whl (19.0 kB view details)

Uploaded CPython 2.6Windows x86-64

bcrypt-2.0.0-cp26-none-win32.whl (18.6 kB view details)

Uploaded CPython 2.6Windows x86

File details

Details for the file bcrypt-2.0.0.tar.gz.

File metadata

  • Download URL: bcrypt-2.0.0.tar.gz
  • Upload date:
  • Size: 38.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for bcrypt-2.0.0.tar.gz
Algorithm Hash digest
SHA256 8b2d197ef220d10eb74625dde7af3b10daa973ae9a1eadd6366f763fad4387fa
MD5 e7fb17be46904cdb2ae6a062859ee58c
BLAKE2b-256 117d4c7980d04314466de42ea804db71995c9b3a2a47dc79a63c51f1be0cfd50

See more details on using hashes here.

File details

Details for the file bcrypt-2.0.0-cp35-none-win_amd64.whl.

File metadata

File hashes

Hashes for bcrypt-2.0.0-cp35-none-win_amd64.whl
Algorithm Hash digest
SHA256 562d1198237756ebf02e08861157aeb8e5500458e11580227360e8b4a7ab0e98
MD5 47642457e4335079ea4b05941e214e54
BLAKE2b-256 8273a5b8c40b410005c229b91c5b600713a91d73770f17a5cd3df68c743101c7

See more details on using hashes here.

File details

Details for the file bcrypt-2.0.0-cp35-none-win32.whl.

File metadata

File hashes

Hashes for bcrypt-2.0.0-cp35-none-win32.whl
Algorithm Hash digest
SHA256 5c5215bbe772b8c308cf12e555230d0ab5e25a3c17e451839e426415b724dfcc
MD5 a3420ffb1a5e4eedb44f1b7d360227ee
BLAKE2b-256 4306f9a1568844b4635766a1099258d72c6f997d367453090405313205b98086

See more details on using hashes here.

File details

Details for the file bcrypt-2.0.0-cp34-none-win_amd64.whl.

File metadata

File hashes

Hashes for bcrypt-2.0.0-cp34-none-win_amd64.whl
Algorithm Hash digest
SHA256 dde11b4c211338af1c515e22e6f8a6358a188568d6ce92c4cbf4ded584c80bc7
MD5 99d08790a80877e53a9c599c408103fc
BLAKE2b-256 7e5a678a85b8e5a89e3f960be2ac03399c62e927c4b23ba7d6a577b62cc092ef

See more details on using hashes here.

File details

Details for the file bcrypt-2.0.0-cp34-none-win32.whl.

File metadata

File hashes

Hashes for bcrypt-2.0.0-cp34-none-win32.whl
Algorithm Hash digest
SHA256 c37f46a59d448b18cea4a96d16f37e38ca4ca5724c277e658f367c2bcbbf3484
MD5 a9e0540b7b1cb4b8e3dafc38243390ef
BLAKE2b-256 a04ab4d27c01e3e4441686dde5c4c67947e060e4b32dfdc067f19bece555dc59

See more details on using hashes here.

File details

Details for the file bcrypt-2.0.0-cp33-none-win_amd64.whl.

File metadata

File hashes

Hashes for bcrypt-2.0.0-cp33-none-win_amd64.whl
Algorithm Hash digest
SHA256 e597c26011b144c5fd7ad6bdc560241195f95f86d589abe9833a2d4bd9a66a69
MD5 e446ed87becdb4d82c11d620d540d777
BLAKE2b-256 6817f9e6f6164eda56c1a41dd5f8c92fbc5ec2622e40daf545809c83589944ce

See more details on using hashes here.

File details

Details for the file bcrypt-2.0.0-cp33-none-win32.whl.

File metadata

File hashes

Hashes for bcrypt-2.0.0-cp33-none-win32.whl
Algorithm Hash digest
SHA256 2d602d691811458f6fd97096aed5537ccd0029e13220afcc2c767db84502adfe
MD5 095ae803a198c4320f50f666ba243b21
BLAKE2b-256 6b9a9da82b58af691910de5c7fb7c0365f5776df7143971385e1044e87cab00e

See more details on using hashes here.

File details

Details for the file bcrypt-2.0.0-cp32-none-win_amd64.whl.

File metadata

File hashes

Hashes for bcrypt-2.0.0-cp32-none-win_amd64.whl
Algorithm Hash digest
SHA256 01ae55ea4b8430567662906561cc7d5605dc0d0230a71f9e5d34ce1c91dab9b4
MD5 fb39fc2d97d018e9ba73c7e75bd8965a
BLAKE2b-256 4a80124453d670d93b35521685a20e3e99b13d09c7462ab102b3179f9196f27d

See more details on using hashes here.

File details

Details for the file bcrypt-2.0.0-cp32-none-win32.whl.

File metadata

File hashes

Hashes for bcrypt-2.0.0-cp32-none-win32.whl
Algorithm Hash digest
SHA256 75bb8083bc6f32f05a4fe8b0393874f6801b6a3f366fbf8bc03387a0baedc04e
MD5 3f87e7ca12522c64cd070a675828ef8d
BLAKE2b-256 2900a48322ecf591b44aec9bac53ed95a828c6910e633eb078c4a8ae9cb64aaf

See more details on using hashes here.

File details

Details for the file bcrypt-2.0.0-cp27-none-win_amd64.whl.

File metadata

File hashes

Hashes for bcrypt-2.0.0-cp27-none-win_amd64.whl
Algorithm Hash digest
SHA256 c512747c10873976e5ebf9419a76bf5be76ff0e4a624e31ca0d4daa0e9348f33
MD5 77a36ba6d66022cc0dc3e83209a10ea2
BLAKE2b-256 e0a6601bac7069e87d4836bc874691be55d65acf8d3c70f3d3650d7b24c51ef1

See more details on using hashes here.

File details

Details for the file bcrypt-2.0.0-cp27-none-win32.whl.

File metadata

File hashes

Hashes for bcrypt-2.0.0-cp27-none-win32.whl
Algorithm Hash digest
SHA256 42e39d6dd11b961856d431006f09f66f00af856bfc9cc50269e8bdd6af4586a3
MD5 d0b937f832bbfbaa9b473b2544d8366d
BLAKE2b-256 28bf5146c0b8a61073c7f44b993f85e50261fb012cf8cb8624f109f9a2905c15

See more details on using hashes here.

File details

Details for the file bcrypt-2.0.0-cp26-none-win_amd64.whl.

File metadata

File hashes

Hashes for bcrypt-2.0.0-cp26-none-win_amd64.whl
Algorithm Hash digest
SHA256 5c78e0416f6372722314aa33bbf944d361aef37870bf57f757960846b52d0fb7
MD5 edaef5404e604c4f2f0cd0236dc6135d
BLAKE2b-256 a191c0cbc96069bcaf79879ab63c9a79cc49048e5bde76aa719a2295219918e2

See more details on using hashes here.

File details

Details for the file bcrypt-2.0.0-cp26-none-win32.whl.

File metadata

File hashes

Hashes for bcrypt-2.0.0-cp26-none-win32.whl
Algorithm Hash digest
SHA256 453bc7cc2d8d808d8ef06bfeca6db230e4de975d7df17d43cc5f8a738ac89691
MD5 28621e0c6f7260be85491b6bb74453b4
BLAKE2b-256 40cfb97593bb539f2ade1d154a43b03d87813df78b88749492907899cf2a7f02

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page