Function dryoc::classic::crypto_pwhash::crypto_pwhash
source · pub fn crypto_pwhash(
output: &mut [u8],
password: &[u8],
salt: &[u8],
opslimit: u64,
memlimit: usize,
algorithm: PasswordHashAlgorithm
) -> Result<(), Error>Expand description
Hashes password with salt, placing the resulting hash into output.
opslimitspecifies the number of iterations to use in the underlying algorithmmemlimitspecifies the maximum amount of memory to use, in bytes
Generally speaking, you want to set opslimit and memlimit sufficiently
large such that it’s hard for someone to brute-force a password.
For your convenience, the following constants are defined which can be used
with opslimit and memlimit:
CRYPTO_PWHASH_OPSLIMIT_INTERACTIVEandCRYPTO_PWHASH_MEMLIMIT_INTERACTIVEfor interactive operationsCRYPTO_PWHASH_OPSLIMIT_MODERATEandCRYPTO_PWHASH_MEMLIMIT_MODERATEfor typical operations, such as server-side password hashingCRYPTO_PWHASH_OPSLIMIT_SENSITIVEandCRYPTO_PWHASH_MEMLIMIT_SENSITIVEfor sensitive operations
Compatible with libsodium’s crypto_pwhash.