Welcome to little lamb

Code » limb » master » tree

[master] / src / doc / pbkdf2.h / pbkdf2.3.md

% limb manual
% pbkdf2(3)
% limb 0.1.0
% 2023-07-24

# NAME

pbkdf2 - derive a key from given password & salt using PBKDF2

# SYNOPSIS

    #include <limb/pbkdf2.h>

```pre hl
int pbkdf2(char *<em>dst</em>, size_t dlen, hasher *<em>hr</em>, const char *<em>pwd</em>, size_t <em>plen</em>,
           const char *<em>salt</em>, size_t <em>slen</em>, size_t <em>iter</em>)
```

# DESCRIPTION

The `pbkdf2`() function derives a key of `dlen` bytes from the given `password`
of length `plen` bytes and `salt` of length `slen` bytes, through `iter`
iterations, using the HMAC based on the cryptographioc hasher `hr`, and writing
it into `dst`, as described in [RFC 8018][rfc8018].

For a list of available hashers, refer to [hasher_hash](3).

[rfc8018]: https://datatracker.ietf.org/doc/html/rfc8018

# RETURN VALUE

The `pbkdf2`() function returns 1 on success. Otherwise it returns 0, which can
only happen if `dlen` is too large, i.e. greater than 2^32 - 1.

# SEE ALSO

[hmac](3), [hasher_hash](3)