3 releases
0.1.2 | Jan 21, 2023 |
---|---|
0.1.1 | Jan 21, 2023 |
0.1.0 | Dec 22, 2022 |
#2027 in Cryptography
30 downloads per month
Used in 2 crates
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.8–1.2MB
~22K SLoC