pub trait PasswordHash: Send + Sync {
// Required methods
fn name(&self) -> &'static str;
fn hash_password(
&self,
password: &[u8],
salt: &[u8],
params: &dyn PasswordHashParams,
out: &mut [u8],
) -> Result<(), CryptoError>;
}Expand description
Password-hashing function (Argon2id, PBKDF2, scrypt, …).
Distinct from Kdf because password KDFs expose memory/time/parallelism
tuning that is irrelevant for stream KDFs like HKDF.
Required Methods§
Sourcefn hash_password(
&self,
password: &[u8],
salt: &[u8],
params: &dyn PasswordHashParams,
out: &mut [u8],
) -> Result<(), CryptoError>
fn hash_password( &self, password: &[u8], salt: &[u8], params: &dyn PasswordHashParams, out: &mut [u8], ) -> Result<(), CryptoError>
Hash password with salt using the given params; write output into out.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".