Skip to content

corydolphin/python-bcrypt

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Python bcrypt

Build Status

This repository is a continuation of the Google Code project, which has not been updated in more than a year.

Most significantly, this clone applies a number of patches which allows compilation on Windows and improves a number of small details in the original implementation, as supplied by the community.

If you have any patches, please submit a pull request and I will happily test and accept.

This branch is tested on and compiles under:

#Python 2.7 X86

  • Windows 7 32bit and 64bit Visual C++ 2012 (MSVC11)
  • Windows 7 32bit and 64bit Visual C++ 2010 (MSVC10)
  • Windows 7 32bit and 64bit Visual C++ 2008 (MSVC9) (Same compiler as Python 2.7, suggested)
  • Gcc 4:4.72 on Ubuntu 12.10

#Python 2.7 X86-64

  • Windows 7 64bit Visual C++ 2012 (MSVC11)
  • Windows 7 64bit Visual C++ 2010 (MSVC10)
  • Windows 7 64bit Visual C++ 2008 (MSVC9) (Same compiler as Python 2.7, suggested)

The original authors whose patches are included in this author are:

This project has been tested using msvc9, and should be compiled with the same C compiler as the python installation you are using (typically, msvc9) If you are having issues compiling on Windows using VC++, fix the msvc9compiler python defaults, and tweak your environment using this guide

benghattem@gmail.com Providing the basis for this patch, fixing compilation flags and ifdefs patch

florian.ruechel@gmail.com Extending the patch and fixing memset + bzero issues to make the code more standards compliant patch

Original README

py-bcrypt is an implementation the OpenBSD Blowfish password hashing algorithm, as described in "A Future-Adaptable Password Scheme" by Niels Provos and David Mazieres: http://www.openbsd.org/papers/bcrypt-paper.ps

This system hashes passwords using a version of Bruce Schneier's Blowfish block cipher with modifications designed to raise the cost of off-line password cracking. The computation cost of the algorithm is parametised, so it can be increased as computers get faster.

py-bcrypt requires Python 2.4. Older versions may work, but the bcrypt.gensalt() method won't - it requires the cryptographic random number generator os.urandom() introduced in 2.4.

To install, use the standard Python distutils incantation:

$ python setup.py build
$ python setup.py install

Regression tests are in the test/test.py file. This is deliberately in a subdirectory so it does not mistakenly pick up the top-level bcrypt/ directory.

py-bcrypt is licensed under a ISC/BSD licence. The underlying Blowfish and password hashing code is taken from OpenBSD's libc. See the LICENSE file for details.

Please report bugs to Damien Miller djm@mindrot.org. Please check the TODO file first, in case your problem is something I already know about (please send patches!)

A simple example that demonstrates most of the features:

	import bcrypt

	# Hash a password for the first time
	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(plaintext, hashed) == hashed:
		print "It matches"
	else:
		print "It does not match"

About

DEPRECATED. An up to date fork of py-bcrypt, Python 3 and Python 2 compatible, compiles on Windows, Mac, Linux

Resources

License

Stars

Watchers

Forks

Packages

No packages published