Skip to main content

hash_password

Function hash_password 

Source
pub fn hash_password(password: &str) -> Result<String, CryptoError>
Available on crate feature crypto only.
Expand description

Hash password using Argon2id with a random salt.

Returns a PHC string ($argon2id$v=19$...) suitable for storing in a database. The salt is embedded in the string — no separate storage needed.

§Errors

Returns CryptoError if the hashing operation fails (extremely unlikely with valid inputs).