forked from mitsuhiko/python-pbkdf2
-
Notifications
You must be signed in to change notification settings - Fork 0
Because pbkdf2 is awesome and bcrypt is overkill
License
badray/python-pbkdf2
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
PBKDF2 for Python Example usage: >> import pbkdf2 >>> pbkdf2.pbkdf2_hex('what i want to hash', 'the random salt') 'fa7cc8a2b0a932f8e6ea42f9787e9d36e592e0c222ada6a9' How to use this: 1. Use a constant time string compare function to compare the stored hash with the one you're generating:: def safe_str_cmp(a, b): if len(a) != len(b): return False rv = 0 for x, y in izip(a, b): rv |= ord(x) ^ ord(y) return rv == 0 2. Use `os.urandom` to generate a proper salt of at least 8 byte. Use a unique salt per hashed password. 3. Store ``algorithm$salt:costfactor$hash`` in the database so that you can upgrade later easily to a different algorithm if you need one. For instance ``PBKDF2-256$thesalt:10000$deadbeef...``. To run tests: 1. Install nosetests 2. Entere project directory and run: $ nosetests :copyright: (c) Copyright 2011 by Armin Ronacher. :license: BSD, see LICENSE for more details.
About
Because pbkdf2 is awesome and bcrypt is overkill
Resources
License
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published
Languages
- Python 100.0%