diff options
author | Eli Collins <elic@assurancetechnologies.com> | 2013-12-22 23:51:28 -0500 |
---|---|---|
committer | Eli Collins <elic@assurancetechnologies.com> | 2013-12-22 23:51:28 -0500 |
commit | 5ddaf2349581d0e83775b69adc568d6625175224 (patch) | |
tree | d6b5955a2550ba0591233b2d1a56a1befa941b16 | |
parent | f1f5a056659522eea4b3ac67db2bae35e39f7365 (diff) | |
download | passlib-5ddaf2349581d0e83775b69adc568d6625175224.tar.gz |
added bcrypt helpers to benchmark script
-rw-r--r-- | admin/benchmarks.py | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/admin/benchmarks.py b/admin/benchmarks.py index 8edbcd5..f0fca6b 100644 --- a/admin/benchmarks.py +++ b/admin/benchmarks.py @@ -213,6 +213,32 @@ def test_context_calls(): # handler benchmarks #============================================================================= @benchmark.constructor() +def test_bcrypt_builtin(): + "test bcrypt 'builtin' backend" + from passlib.hash import bcrypt + import os + os.environ['PASSLIB_BUILTIN_BCRYPT'] = 'enabled' + bcrypt.set_backend("builtin") + bcrypt.default_rounds = 10 + def helper(): + hash = bcrypt.encrypt(SECRET) + bcrypt.verify(SECRET, hash) + bcrypt.verify(OTHER, hash) + return helper + +@benchmark.constructor() +def test_bcrypt_ffi(): + "test bcrypt 'bcrypt' backend" + from passlib.hash import bcrypt + bcrypt.set_backend("bcrypt") + bcrypt.default_rounds = 8 + def helper(): + hash = bcrypt.encrypt(SECRET) + bcrypt.verify(SECRET, hash) + bcrypt.verify(OTHER, hash) + return helper + +@benchmark.constructor() def test_md5_crypt_builtin(): "test test md5_crypt builtin backend" from passlib.hash import md5_crypt |