-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Parameter extraction functions #55
Comments
I was going to tackle it, but I had hard time figuring out how to extract the salt, should I use the default to fake it? |
@blackheaven Thank you for taking a stab at this. Every |
After a second read you're right but (except So, just to be sure: we want to have functions which extracts |
Be aware that the parameters for passwords never contain salts. Salts are supposed to be random for security's sake. The Also, |
I've made an attempt in #61. There's two ways to mitigate de default value issue coming to my mind:
Let me know what you think, and whether I should handle it it in my PR, another one, or not at all. |
I'm pretty sure that the following holds: -- This doesn't actually work, since 'newSalt' is in IO, but you get the idea
testProperty "length of salt = size of salt" $ \i ->
let Salt salt = Data.Password.Internal.newSalt i
in Data.ByteString.length salt === i So you can just get the salt size from the salt: -- e.g. the Argon2 one
extractParams passHash = do
(params, Salt salt, _) <- parseArgon2PasswordHashParams passHash
let saltSize = Data.ByteString.length salt
pure params{argon2Salt = saltSize} |
#61 implemented this |
Might be nice to also expose the functions that take a
PasswordHash a
and return the parameters for that hash. (in case the hash is parsable)e.g.
extractParams :: PasswordHash Scrypt -> Maybe ScryptParams
Which later on might be extended to
extractParamsWithFormat :: ScryptFormat -> PasswordHash Scrypt -> Maybe ScryptParams
when we also support different hashing formats.Kind of part of the #22 enhancement, so users can check hashes. e.g. when filtering hashes from a DB.
The text was updated successfully, but these errors were encountered: