CryptContext.verify requires unicode hash argument.
Documentation for CryptContext.verify(secret, hash, scheme=None, category=None, **kwds)
states that the secret
and hash
arguments can be either unicodes or bytes, but passing a valid secret
and hash
as a byte string produces:
... Traceback (most recent call last):
File "/var/MM/3/conf/mailman/src/mailman/utilities/passwords.py", line 62, in verify
ret = self._context.verify_and_update(password, hashed)
File "/var/MM/3/conf/mailman/.tox/py37-nocov/lib/python3.7/site-packages/passlib/context.py", line 2435, in verify_and_update
elif record.deprecated or record.needs_update(hash, secret=secret):
File "/var/MM/3/conf/mailman/.tox/py37-nocov/lib/python3.7/site-packages/passlib/utils/handlers.py", line 2672, in needs_update
hash = self._unwrap_hash(hash)
File "/var/MM/3/conf/mailman/.tox/py37-nocov/lib/python3.7/site-packages/passlib/utils/handlers.py", line 2640, in _unwrap_hash
if not hash.startswith(prefix):
TypeError: startswith first arg must be bytes or a tuple of bytes, not str