Bowe Strickland
2018-10-26 29e4dce0a2ba187091b4644e2003297300162673
repoze/who/plugins/htpasswd.py
@@ -96,6 +96,15 @@
    salt = hashed[:2]
    return _same_string(hashed, crypt(password, salt))
def sha1_check(password, hashed):
    from hashlib import sha1
    from base64 import standard_b64encode
    from repoze.who._compat import must_encode
    encrypted_string = standard_b64encode(sha1(must_encode(password)).digest())
    if hasattr(encrypted_string, "decode"):
        encrypted_string = encrypted_string.decode()
    return _same_string(hashed, "%s%s" % ("{SHA}", encrypted_string))
def plain_check(password, hashed):
    return _same_string(password, hashed)