Add an optional dependency on python-fastpbkdf2
Created originally on Bitbucket by Anonymous
I maintain python-fastpbkdf2, a hashlib.pbkdf2_hmac
compatible interface that's around 3 times faster on CPython and more than 10x faster on PyPy.
This is the benchmark I use:
#!python
#!/usr/bin/bash
echo "Benchmark hashlib..."
python -m timeit -n 100 -s "from hashlib import pbkdf2_hmac" "pbkdf2_hmac('sha1', b'password', b'salt', 100000)"
echo "Benchmark fastpbkdf2..."
python -m timeit -n 100 -s "from fastpbkdf2 import pbkdf2_hmac" "pbkdf2_hmac('sha1', b'password', b'salt', 100000)"
On CPython 3.4.1,
$ ./bench.sh
Benchmark hashlib...
100 loops, best of 3: 60.2 msec per loop
Benchmark fastpbkdf2...
100 loops, best of 3: 20.3 msec per loop
On PyPy 2.6.0:
$ ./bench.sh
Benchmark hashlib...
100 loops, best of 3: 242 msec per loop
Benchmark fastpbkdf2...
100 loops, best of 3: 19.2 msec per loop
A faster PBKDF2 implementation improves security because a higher work factor can be used for the same amount of computing power. Would a patch to switch passlib's PBKDF2 implementation to this library be accepted?