Using Bcrypt

Start by adding bcrypt to your base.in file and installing it (version 3.1.4 at the time of writing) using the same process as earlier.

If you have issues installing Bcrypt, please see their installation instructions, which include details on system package dependencies: http://url.marcuspen.com/pypi-bcrypt.

In order for bcrypt to create a hash of a password, it requires two things—your password and a salt. A salt is simply a string of random characters. Let's look at how you can create a salt in Python:

>>> from bcrypt import gensalt
>>> gensalt()
b'$2b$12$fiDoHXkWx6WMOuIfOG4Gku'

This is the simplest way to create a salt compatible with Bcrypt. The $ symbols represent different parts of the salt, and I'd like to point out the ...

Get Python Programming Blueprints now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.