ObjFW
Functions
pbkdf2.h File Reference
#import "macros.h"

Go to the source code of this file.

Functions

void of_pbkdf2 (OFHMAC *HMAC, size_t iterations, const unsigned char *salt, size_t saltLength, const char *password, size_t passwordLength, unsigned char *key, size_t keyLength)
 Derive a key from a password and a salt. More...
 

Function Documentation

◆ of_pbkdf2()

void of_pbkdf2 ( OFHMAC HMAC,
size_t  iterations,
const unsigned char *  salt,
size_t  saltLength,
const char *  password,
size_t  passwordLength,
unsigned char *  key,
size_t  keyLength 
)

Derive a key from a password and a salt.

Note
This will call reset (OFHMAC) on the OFHMAC first, making it possible to reuse the OFHMAC, but also meaning all previous results from the OFHMAC get invalidated if they have not been copied.
Parameters
HMACThe HMAC to use to derive a key
iterationsThe number of iterations to perform
saltThe salt to derive a key with
saltLengthThe length of the salt
passwordThe password to derive a key from
passwordLengthThe length of the password
keyThe buffer to write the key to
keyLengthThe desired length for the derived key (key needs to have enough storage)