summaryrefslogtreecommitdiff
path: root/passlib/context.py
diff options
context:
space:
mode:
authorEli Collins <elic@assurancetechnologies.com>2011-10-07 21:39:00 -0400
committerEli Collins <elic@assurancetechnologies.com>2011-10-07 21:39:00 -0400
commitaa5a479ebd92022691fe5ca933bedc2c81e7773c (patch)
tree3f5236d9e90f3bdb65927a033d3a1c9256cb5f95 /passlib/context.py
parent88eff23353cf2f1b17971f1a97894e8c8e99a7d6 (diff)
downloadpasslib-aa5a479ebd92022691fe5ca933bedc2c81e7773c.tar.gz
bcrypt padding work:
* added changelog entry re: issue & fix * bcrypt now warns about padding bits in digest as well * bcrypt.normhash() now normalizes salt padding bits, digest padding bits, and rounds zero-padding * hash_needs_update() will now flag unclean bcrypt hashes as needing an update * UTs for hash_needs_update(), and digest padding bit handling
Diffstat (limited to 'passlib/context.py')
-rw-r--r--passlib/context.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/passlib/context.py b/passlib/context.py
index 46bcec3..f27e6c0 100644
--- a/passlib/context.py
+++ b/passlib/context.py
@@ -954,6 +954,11 @@ class CryptContext(object):
#XXX: could check if handler provides it's own helper, eg getattr(handler, "hash_needs_update", None),
#and call that instead of the following default behavior
+ if hasattr(handler, "_hash_needs_update"):
+ #NOTE: hacking this in for the sake of bcrypt & issue 25,
+ # will formalize (and possibly change) interface later.
+ if handler._hash_needs_update(hash, **opts):
+ return True
if opts:
#check if we can parse hash to check it's rounds parameter