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");
match password.verify("my_secret", hash) {
.Ok(true) => println("password matches"),
.Ok(false) => println("password does not match"),
.Err(error) => println(f"verification failed: {error}"),
}
}
hashHash a password using Argon2id with default parameters.
Returns the PHC-format hash string, suitable for storage.
import std.crypto.password;
fn main() {
let hash = password.hash("hunter2");
}
verifyVerify a password while distinguishing malformed hashes from mismatches.
hash_customHash with a custom cost while rejecting values that cannot cross the ABI.