User Tools

Site Tools




Quick links in case you need to verify things:

General Security

Shamus attempts to explain hashing then Use bcrypt to store passwords.

Consider py-bcrypt at No documentation there, yet. Old documentation.

At the bottom of this page, is the compiler used to make Python 2.6 and 2.7 Visual Studio 2008 Express.

On Windows, you'll have to make the following change:

$ diff bcrypt_python.c
>       char *password_copy;
>       char *salt_copy;
<       char *password_copy = strdup(password);
<       char *salt_copy = strdup(salt);
>       password_copy = strdup(password);
>       salt_copy = strdup(salt);

Then you can build it with setup, like so:

c:\Python27\python.exe build
import bcrypt

# Hash a password for the first time, with a randomly-generated salt
hashed = bcrypt.hashpw(password, bcrypt.gensalt())

# gensalt's log_rounds parameter determines the complexity.
# The work factor is 2**log_rounds, and the default is 12
hashed = bcrypt.hashpw(password, bcrypt.gensalt(10))

# Check that an unencrypted password matches one that has
# previously been hashed
if bcrypt.hashpw(password, hashed) == hashed:
    print "It matches"
    print "It does not match"

Never use passwords whose unsalted MD5 hash can be looked up here:

AES encryption of files in Python with PyCrypto. Note that pycrypto-2.3 can be built with the same c:\Python27\python.exe build mechanism.

Someone suggested Whirlpool_(cryptography), it's offered in mhash, and a pure-python implementation from Bjorn Edstrom 16 december 2007 is here


Maybe I should try to automate a way to verify the SHA1 Checksums of PGP signatures and upon success, verify the PHP signatures. Here's an old recipe: HOWTO: Verify a PGP Signature.

Keywords: crypt, cryptography pgp sha

security.txt · Last modified: 2021/05/21 00:04 (external edit)