Skip to content
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

Document minimum log rounds #79

Closed
pdilyard opened this issue Apr 7, 2016 · 4 comments
Closed

Document minimum log rounds #79

pdilyard opened this issue Apr 7, 2016 · 4 comments
Assignees

Comments

@pdilyard
Copy link

pdilyard commented Apr 7, 2016

I had added this line in my test config:

config :comeonin, :bcrypt_log_rounds, 1

which did not make my tests any faster. I looked into the source code, and found that if the value is not between 4 and 32, it gets thrown out and 12 gets used (changing my config to 4 made my tests fast again). I asked about this in the Elixir Slack channel and found that this has confused others in the past.

I think this should either be strongly documented or throw a warning instead of just silently using 12.

Thanks!

@riverrun
Copy link
Owner

riverrun commented Apr 8, 2016

Yes, it's documented in the gen_salt function, but not in the hashpwsalt function, which might be confusing. Maybe raising an error would provide more forceful 'documentation' :)
I'll let you know what I decide on.

@riverrun riverrun self-assigned this Apr 8, 2016
@pdilyard
Copy link
Author

pdilyard commented Apr 8, 2016

At the very least I'd recommend adding a little note to the README in step 4 of the Installation section.

@riverrun
Copy link
Owner

riverrun commented Apr 9, 2016

I've just released version 2.4, and these are the changes:

  • If the log_rounds is less than 4, then gen_salt will use 4 log_rounds, and if log_rounds is more than 31, gen_salt will use 31 log_rounds (this is the default behavior for the OpenBSD version of bcrypt). If the log_rounds argument is the wrong type, then an error will be raised.
  • Added documentation to bcrypt_log_rounds in the Config module.

@pdilyard
Copy link
Author

pdilyard commented Apr 9, 2016

Awesome, thanks! I think this will help keep a lot of people from tripping up.

@pdilyard pdilyard closed this as completed Apr 9, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants