#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

#1679 in Cryptography

Download history 30/week @ 2024-02-19 20/week @ 2024-02-26 32/week @ 2024-03-11 8/week @ 2024-03-18 12/week @ 2024-03-25 35/week @ 2024-04-01

87 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