std::crypto::passwordPassword hashing and verification (Argon2id).
Hash passwords for storage and verify them later. Uses Argon2id with secure default parameters.
import std::crypto::password;
fn main() {
let hash = password.hash("my_secret");
if password.verify("my_secret", hash) {
println("password matches");
}
}
hashHash a password using Argon2id with default parameters.
Returns the PHC-format hash string, suitable for storage.
let hash = password.hash("hunter2");
verifyVerify a password against a hash.
Returns true if the password matches, false otherwise.
if password.verify("hunter2", stored_hash) {
println("access granted");
}
hash_customHash a password using Argon2id with a custom cost (iteration count).
Higher cost values are slower but more secure. The default is 3.
let hash = password.hash_custom("hunter2", 6);