#password-hashing #argon2 #helper #requirements #hash #salt #function

argon_hash_password

Helper functions for common argon2 password hashing requirements

3 releases

0.1.2 Jan 21, 2023
0.1.1 Jan 21, 2023
0.1.0 Dec 22, 2022

#1706 in Cryptography

Download history 17/week @ 2024-03-14 10/week @ 2024-03-21 30/week @ 2024-03-28 14/week @ 2024-04-04 7/week @ 2024-04-11 4/week @ 2024-04-18 11/week @ 2024-04-25 4/week @ 2024-05-02 4/week @ 2024-05-09 10/week @ 2024-05-16 9/week @ 2024-05-23 11/week @ 2024-05-30 57/week @ 2024-06-06 74/week @ 2024-06-13 27/week @ 2024-06-20 46/week @ 2024-06-27

206 downloads per month
Used in 2 crates

Custom license

7KB
99 lines

Argon Hash Password

Helper functions for common argon2 password hashing requirements

Create a hashed password with salt

let (hash, salt) = argon_hash_password::create_hash_and_salt("PlaintextPassword");

The hash and salt can then be stored

Check a Hash

let check = argon_hash_password::check_password_matches("PlaintextPassword", hash, salt);

match check {
  true => println!("Correct plaintext password provided"),
  false => println!("Incorrect plaintext password provided"),
}

lib.rs:

Functions for creating hashed passwords with salt using argon2

Create a hashed password with salt

let (hash, salt) = argon_hash_password::create_hash_and_salt("PlaintextPassword").unwrap();

The hash and salt can then be stored

Check a Hash

let check = argon_hash_password::check_password_matches_hash("PlaintextPassword", hash, salt).unwrap();
match check {
    true => println!("Correct plaintext password provided"),
    false => println!("Incorrect plaintext password provided"),
}

Dependencies

~0.9–1.1MB
~22K SLoC