From aa5a479ebd92022691fe5ca933bedc2c81e7773c Mon Sep 17 00:00:00 2001 From: Eli Collins Date: Fri, 7 Oct 2011 21:39:00 -0400 Subject: 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 --- docs/lib/passlib.hash.bcrypt.rst | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'docs') diff --git a/docs/lib/passlib.hash.bcrypt.rst b/docs/lib/passlib.hash.bcrypt.rst index 2b9a22d..27027b4 100644 --- a/docs/lib/passlib.hash.bcrypt.rst +++ b/docs/lib/passlib.hash.bcrypt.rst @@ -90,6 +90,19 @@ This implementation of bcrypt differs from others in a few ways: encoding is desired by an application, the password should be encoded before handing it to PassLib. +* Padding Bits + + BCrypt's base64 encoding results in the last character of the salt + encoding only 2 bits of data, the remaining 4 are "padding" bits. + Similarly, the last character of the digest contains 4 bits of data, + and 2 padding bits. Because of the way they are coded, many BCrypt implementations + will reject all passwords if these padding bits are not set to 0. + Due to a legacy issue with Passlib <= 1.5.2, + Passlib instead prints a warning if it encounters hashes with any padding bits set, + and will then validate them correctly. + (This behavior will eventually be deprecated and such hashes + will throw a :exc:`ValueError` instead). + .. rubric:: Footnotes .. [#f1] ``_ - the bcrypt format specification -- cgit v1.2.1