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.

  • opslimit specifies the number of iterations to use in the underlying algorithm
  • memlimit specifies 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:

Compatible with libsodium’s crypto_pwhash.