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

Built-in password hashing function [auth project] #82

Open
thangngoc89 opened this issue Jun 30, 2021 · 4 comments
Open

Built-in password hashing function [auth project] #82

thangngoc89 opened this issue Jun 30, 2021 · 4 comments

Comments

@thangngoc89
Copy link
Contributor

thangngoc89 commented Jun 30, 2021

I believe that a good first step in an authentication system would be having secure password hashing function according to latest security recommendation. I've spent several hours making one for my Dream server so I want to share it here for feedbacks:

The interface looks like this:

type error;

type params = {
  time_cost: int,
  memory_cost_kiB: int,
  parallelism: int,
  hash_len: int,
  salt_len: int,
};

let recommend_params: params;
let minimum_params: params;

let hash: (~params: params=?, string) => result(string, error);
let verify: (~hash: string, ~password: string) => result(bool, error);

let error_to_string: error => string;

Here is this gist for full implementation

By default calling hash with a string would use recommend_params .

@aantron
Copy link
Owner

aantron commented Jul 1, 2021

Thanks! I will give this a thorough look as we address the auth gap. We need this or something like it for simple password authentication (as opposed to social login or TOTP).

@aantron aantron changed the title Built-in password hashing function Built-in password hashing function [auth project] Jul 3, 2021
@aantron
Copy link
Owner

aantron commented Jul 3, 2021

This issue or work related to it is also a good opportunity to make sure argon2 can be linked properly in all environments and on all systems. The comment is based on the difficulties linking with it observed on Discord. libargon2 should probably be vendored as done with libuv in Luv, if at all possible.

@thangngoc89
Copy link
Contributor Author

I have made an esy-argon2 package here https://github.com/thangngoc89/esy-argon2 . You can install it in any esy project to get libargon2 without messing up with your OS package manager. Though I didn’t test this on Windows so I might now work

@thangngoc89
Copy link
Contributor Author

Update: libsodium provides pwhash* functions that uses argon2 under the hood.

ocaml-sodium exposes it but iirc, it’s only argon2i , works need to be done to expose argon2d and argon2id

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants