erlangpack / bcrypt

Erlang wrapper for OpenBSD's Blowfish password hashing code
https://hex.pm/packages/bcrypt
Other
16 stars 19 forks source link

Make bcrypt twice faster with -O2 #4

Closed egobrain closed 4 years ago

egobrain commented 6 years ago

Before:

1> {ok, S} = bcrypt:gen_salt().
2> timer:tc(fun bcrypt:hashpw/2, ["foo", S]).
{583350, {ok,"$2a$12$KGDV3lQV4Q9RasBvnDLv1eWsS8.dlQA7JRP3ldoh3fNrseGI4zzP2"}}

After:

1> {ok, S} = bcrypt:gen_salt().
2> timer:tc(fun bcrypt:hashpw/2, ["foo", S]).
{284084, {ok,"$2a$12$ta6Uz873HOhJGvwb64jdpOSgbenQwECZzs/ag2kf3EX..17Z3ijSS"}}
ddeboer commented 6 years ago

Nice! Would -O3 also work and, if so, does it make any difference?

mworrell commented 4 years ago

I guess, till we figure out the effect of O3 we can just merge this.

mworrell commented 4 years ago

Thanks @egobrain, good small change with big impact.