Expand description
Password hashing, keyed authentication, and digest helpers.
Passwords are hashed with an explicit Argon2id policy and a fresh salt for storage. Stored PHC strings are checked against finite verification limits before Argon2 allocates its work memory. SHA-256 helpers cover deterministic digest cases, while HMAC-SHA-256 covers keyed cache and lookup components that must not expose a fast, reusable digest of a low-entropy secret.
Structs§
- Password
Hash Policy - Password hashing and verification policy.
- Password
Hash Verification - Detailed result of password verification.
- Password
Hash Verification Limits - Absolute resource limits accepted when verifying a stored Argon2id PHC string.
- Password
Hash Work Factor - Argon2id work factor used when creating new password hashes.
Functions§
- bytes_
to_ hex - Encodes arbitrary bytes as lowercase hex.
- hash_
password - Hashes a password with the default RFC 9106 second recommended policy.
- hash_
password_ with_ policy - Hashes a password with an explicit policy and a fresh random salt.
- hmac_
sha256_ hex - Computes HMAC-SHA-256 over
dataand returns lowercase hex. - new_
sha256 - Creates a new incremental SHA-256 hasher.
- sha256_
digest_ to_ hex - Encodes a SHA-256 digest as lowercase hex.
- sha256_
hex - Computes the SHA-256 digest of
dataand returns lowercase hex. - verify_
password - Verifies a password with the default policy.
- verify_
password_ with_ policy - Verifies a password with an explicit policy and reports whether a matching hash needs upgrade.