PBKDF2¶
-
cardano_error_t cardano_crypto_pbkdf2_hmac_sha512(const byte_t *password, size_t password_length, const byte_t *salt, size_t salt_length, uint32_t iterations, byte_t *derived_key, size_t derived_key_length)¶
Performs key derivation using the PBKDF2 algorithm with HMAC-SHA512.
PBKDF2 (Password-Based Key Derivation Function 2) is a key derivation function that has a sliding computational cost, aimed to reduce vulnerabilities to brute force attacks. It applies a pseudorandom function, such as HMAC-SHA512, to the input password along with a salt value and repeats the process multiple times to produce a derived key. The iterations parameter controls the number of times the pseudorandom function is applied, which increases the computational cost and the time required to compute the derived key, thereby enhancing security.
- Parameters:¶
- const byte_t *password¶
[in] The input password from which the key is derived.
- size_t password_length¶
[in] The length of the password.
- const byte_t *salt¶
[in] A cryptographic salt.
- size_t salt_length¶
[in] The length of the salt.
- uint32_t iterations¶
[in] The number of iterations specifies how many times the pseudorandom function is applied.
- byte_t *derived_key¶
[out] The buffer where the derived key will be stored.
- size_t derived_key_length¶
[in] The desired length of the derived key.
- Returns:¶
A cardano_error_t indicating the result of the operation: CARDANO_SUCCESS on success, or an appropriate error code indicating the failure reason. Refer to cardano_error_t documentation for details on possible error codes.