riverrun / argon2_elixir

Elixir wrapper for the Argon2 password hashing algorithm
Apache License 2.0
229 stars 34 forks source link

How to use argon2id (usage example) ? #17

Closed nelsonic closed 6 years ago

nelsonic commented 6 years ago

Hi @riverrun, thanks for making this package!

Quick question: how can we use argon2id to hash_password ?

from /lib/argon2.ex: https://github.com/riverrun/argon2_elixir/blob/91a911eb1197528689e47d76580c06ddfeb207d3/lib/argon2.ex#L176 it's apparent that it's possible to use the argon2id but there is no usage example in the docs (readme) or in the tests /test/argon2_test.exs

I tried to add the following lines to config.exs:

config :argon2_elixir,
  argon2_type: 2

I'm keen to use argon2id because of: https://crypto.stackexchange.com/questions/48935/why-use-argon2i-or-argon2d-if-argon2id-exists

nelsonic commented 6 years ago

invoking the hash_password function with the following format:

Argon2.Base.hash_password("password", "salt", [{:argon2_type, 2}])

Appears to work. Should this be added to the Docs for future users?

riverrun commented 6 years ago

Hi. Thanks for raising the issue. I can have a look at this later this week - I'll probably update the docs, and you suggested.

riverrun commented 6 years ago

18 allows you to set the argon2 type in the config, but I do also need to update the docs - which I will do soon.

riverrun commented 6 years ago

I just updated the docs (and released version 1.3), adding a few more examples for both Base.hash_password and hash_pwd_salt.

Thanks for sending the link. It's good to see what current thoughts are about the different options available.