summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEli Collins <elic@assurancetechnologies.com>2013-12-22 23:51:28 -0500
committerEli Collins <elic@assurancetechnologies.com>2013-12-22 23:51:28 -0500
commit5ddaf2349581d0e83775b69adc568d6625175224 (patch)
treed6b5955a2550ba0591233b2d1a56a1befa941b16
parentf1f5a056659522eea4b3ac67db2bae35e39f7365 (diff)
downloadpasslib-5ddaf2349581d0e83775b69adc568d6625175224.tar.gz
added bcrypt helpers to benchmark script
-rw-r--r--admin/benchmarks.py26
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