diff options
author | Eli Collins <elic@assurancetechnologies.com> | 2016-11-09 16:58:57 -0500 |
---|---|---|
committer | Eli Collins <elic@assurancetechnologies.com> | 2016-11-09 16:58:57 -0500 |
commit | 85e217857f68d62013dc12117b9a9649b893fbae (patch) | |
tree | a7e0758a863790661504ec1720f4eeb7a61f8810 | |
parent | becdbf0042bab294938cfa33d8fa93b7fd2dcf0b (diff) | |
download | passlib-85e217857f68d62013dc12117b9a9649b893fbae.tar.gz |
hash / bcrypt: normalized support log & error message formats
-rw-r--r-- | passlib/handlers/bcrypt.py | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/passlib/handlers/bcrypt.py b/passlib/handlers/bcrypt.py index 423503c..5662267 100644 --- a/passlib/handlers/bcrypt.py +++ b/passlib/handlers/bcrypt.py @@ -371,20 +371,20 @@ class _BcryptCommon(uh.SubclassBackendMixin, uh.TruncateMixin, uh.HasManyIdents, test_hash_20 = b"$2$04$5BJqKfqMQvV7nS.yUguNcuRfMMOXK0xPWavM7pOzjEi5ze5T1k8/S" result = safe_verify("test", test_hash_20) if not result: - raise RuntimeError("%s incorrect rejected 20 hash" % backend) + raise RuntimeError("%s incorrectly rejected $2$ hash" % backend) elif result is NotImplemented: mixin_cls._lacks_20_support = True - log.debug("%r backend lacks 20 support, enabling workaround", backend) + log.debug("%r backend lacks $2$ support, enabling workaround", backend) #---------------------------------------------------------------- # check for 2a support #---------------------------------------------------------------- result = safe_verify("test", TEST_HASH_2A) if not result: - raise RuntimeError("%s incorrected rejected 2a hash" % backend) + raise RuntimeError("%s incorrectly rejected $2a$ hash" % backend) elif result is NotImplemented: # 2a support is required, and should always be present - raise RuntimeError("%s lacks support for 2a hashes" % backend) + raise RuntimeError("%s lacks support for $2a$ hashes" % backend) else: assert_lacks_8bit_bug(IDENT_2A) if detect_wrap_bug(IDENT_2A): @@ -401,10 +401,10 @@ class _BcryptCommon(uh.SubclassBackendMixin, uh.TruncateMixin, uh.HasManyIdents, test_hash_2y = TEST_HASH_2A.replace(b"2a", b"2y") result = safe_verify("test", test_hash_2y) if not result: - raise RuntimeError("%s incorrectly rejected 2y hash" % backend) + raise RuntimeError("%s incorrectly rejected $2y$ hash" % backend) elif result is NotImplemented: mixin_cls._lacks_2y_support = True - log.debug("%r backend lacks 2y support, enabling workaround", backend) + log.debug("%r backend lacks $2y$ support, enabling workaround", backend) else: # NOTE: Not using this as fallback candidate, # lacks wide enough support across implementations. @@ -421,10 +421,10 @@ class _BcryptCommon(uh.SubclassBackendMixin, uh.TruncateMixin, uh.HasManyIdents, test_hash_2b = TEST_HASH_2A.replace(b"2a", b"2b") result = safe_verify("test", test_hash_2b) if not result: - raise RuntimeError("%s incorrectly rejected 2b hash" % backend) + raise RuntimeError("%s incorrectly rejected $2b$ hash" % backend) elif result is NotImplemented: mixin_cls._lacks_2b_support = True - log.debug("%r backend lacks 2b support, enabling workaround", backend) + log.debug("%r backend lacks $2b$ support, enabling workaround", backend) else: mixin_cls._fallback_ident = IDENT_2B assert_lacks_8bit_bug(IDENT_2B) @@ -973,7 +973,7 @@ class bcrypt_sha256(_wrapped_bcrypt): return super(bcrypt_sha256, self)._calc_checksum(key) # XXX: have _needs_update() mark the $2a$ ones for upgrading? - # so do that after we switch to hex encoding? + # maybe do that after we switch to hex encoding? #============================================================================= # eof |