Replies: 1 comment 1 reply
-
Interesting! Actually, we already have Lines 85 to 87 in 17fd0c6 The main wrapper doesn't expose it, but I suppose we could add it. Something like: class PasswordHash:
# ...
def identify(
self, hash: typing.Union[str, bytes]
) -> HasherProtocol:
for hasher in self.hashers:
if hasher.identify(hash):
return hasher
raise exceptions.UnknownHashError(hash) If you want to take a stab at a PR, you're very welcome 🙏 |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I noticed that with
argon2
at least you can know if astr
actually represents a hashed password. It has a specific format that encodes this information.I'm currently writing a custom type decorator for SQLAlchemy that hashes a password if it is unhashed and to prevent already hashed passwords from being rehashed, it would be nice to have a way (say, a
pwdlib.is_hashed
function) to check if it at least looks like a hashed password from pwdlib.If course, I can just tag my passwords with something like a
hashed:
prefix, but I think this is seriously redundant considering pwd already has this information encoded.What do you think?
Beta Was this translation helpful? Give feedback.
All reactions