Enocde non-bytes before hasing.
| | |
| | | |
| | | 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 |
| | |
| | | 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): |