[][src]Function devolutions_crypto::ffi::HashPassword

#[no_mangle]
pub unsafe extern "C" fn HashPassword(
    password: *const u8,
    password_length: usize,
    iterations: u32,
    result: *mut u8,
    result_length: usize
) -> i64

Hash a password using a high-cost algorithm.

Arguments

  • password - Pointer to the password to hash.
  • password_length - Length of the password to hash.
  • iterations - Number of iterations of the password hash. A higher number is slower but harder to brute-force. The recommended is 10000, but the number can be set by the user.
  • result - Pointer to the buffer to write the hash to.
  • result_length - Length of the buffer to write the hash to. You can get the value by calling HashPasswordLength() beforehand.

Returns

This returns the length of the hash. If there is an error, it will return the appropriate error code defined in DevoCryptoError.