From 5ddaf2349581d0e83775b69adc568d6625175224 Mon Sep 17 00:00:00 2001 From: Eli Collins Date: Sun, 22 Dec 2013 23:51:28 -0500 Subject: added bcrypt helpers to benchmark script --- admin/benchmarks.py | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/admin/benchmarks.py b/admin/benchmarks.py index 8edbcd5..f0fca6b 100644 --- a/admin/benchmarks.py +++ b/admin/benchmarks.py @@ -212,6 +212,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" -- cgit v1.2.1