pub fn crypto_pwhash_str_alg(
password: &[u8],
opslimit: u64,
memlimit: usize,
algorithm: PasswordHashAlgorithm,
) -> Result<String, Error>Available on crate feature
base64 only.Expand description
Hashes a password with a random salt and the selected algorithm, returning a database-safe encoded string.
Compatible with libsodium’s crypto_pwhash_str_alg.
§Errors
Returns an error if the password or resource limits are unsupported, or if Argon2 cannot hash the password.
§Panics
Panics if the operating system’s random number generator fails.