Expand description
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"),
}Functions§
- check_
password_ matches_ hash - Check that password and salt matches generated hash
- create_
hash_ and_ salt - Given a plaintext password return a password hash and a generated salt
- gen_
session_ id - Generate a secure 128-bit session ID of alphanumeric characters
- hash_
and_ verify - Given a plaintext password and a SaltString, return the hash of the password
- parse_
saltstring - verify_
password_ len - Verify that the password matches a certain length and the confirmation password provided