Tres Seaver
2012-03-18 e273050c343802dbb9e847722afc48ff3e636184
Enocde non-bytes before hasing.
2 files modified
4 ■■■■ changed files
repoze/who/plugins/sql.py 2 ●●●●● patch | view | raw | blame | history
repoze/who/plugins/tests/test_sql.py 2 ●●●●● patch | view | raw | blame | history
repoze/who/plugins/sql.py
@@ -14,6 +14,8 @@
    if stored_password_hash.startswith('{SHA}'):
        stored_password_hash = stored_password_hash[5:]
        if not isinstance(cleartext_password, type(b'')):
            cleartext_password = cleartext_password.encode('utf-8')
        digest = sha1(cleartext_password).hexdigest()
    else:
        digest = cleartext_password
repoze/who/plugins/tests/test_sql.py
@@ -78,6 +78,8 @@
            from hashlib import sha1
        except ImportError:
            from sha import new as sha1
        if not isinstance(clear, type(b'')):
            clear = clear.encode('utf-8')
        return sha1(clear).hexdigest()
    def test_shaprefix_success(self):