-
Notifications
You must be signed in to change notification settings - Fork 5
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
remove fast_pbkdf2 dependency #11
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Had questions about the KeyLength but looks here to be the same as fast_pbkdf2.
LGTM
Amazing idea, I wanted to get to try this for a while, thank you so much for the contribution! Nevertheless, I'll get picky with performance: it is indeed pretty much in all cases 1.85x slower. I tried benchee with these inputs: Benchee.run(
%{
"fast" => fn {hash, pass, salt, it} -> :fast_pbkdf2.pbkdf2(hash, pass, salt, it) end,
"otp" => fn {hash, pass, salt, it} ->
%{ size: len } = :crypto.hash_info(hash)
:crypto.pbkdf2_hmac(hash, pass, salt, it, len)
end
},
inputs: %{
"sha256-12password-1024it" => {:sha256,
:base64.encode(:crypto.strong_rand_bytes(8)),
:base64.encode(:crypto.strong_rand_bytes(8)),
1024},
"sha256-12password-10000it" => {:sha256,
:base64.encode(:crypto.strong_rand_bytes(8)),
:base64.encode(:crypto.strong_rand_bytes(8)),
10000},
"sha256-12password-500000it" => {:sha256,
:base64.encode(:crypto.strong_rand_bytes(8)),
:base64.encode(:crypto.strong_rand_bytes(8)),
500000},
"sha256-32password-1024it" => {:sha256,
:base64.encode(:crypto.strong_rand_bytes(22)),
:base64.encode(:crypto.strong_rand_bytes(8)),
1024},
"sha256-32password-10000it" => {:sha256,
:base64.encode(:crypto.strong_rand_bytes(22)),
:base64.encode(:crypto.strong_rand_bytes(8)),
10000},
"sha256-32password-500000it" => {:sha256,
:base64.encode(:crypto.strong_rand_bytes(22)),
:base64.encode(:crypto.strong_rand_bytes(8)),
500000}
},
memory_time: 5
) All of them memory-wise take 72B for My implementation surely does the proper (that's the whole point why I did it :D), so that 1.85x diff makes me think Even more interesting, when setting parallelism to 12 (the number of cores in my machine), Still, I agree simplicity of dependencies is a great win, so I wouldn't say no even for a 2x factor. But at such factor I'd like to have it possible to choose. After all, half a million iterations is not unheard of. Do you know think we can make this configurable? 🙂 |
@benoitc any news on this contribution? |
Closed in favour of #13 |
This PR remove the usage of fast_pbldf2 by using latest crypto API in Erlang. If needed i will add some legacy support for fast_pbkdf2. Or should it be an option?
I did remove this library because any libray based on openssl is hard to to deploy in multiple environnement, and I don't think the performance s lower with this change though I didn't measure it precisely first.