fn pbkdf2(dk: []u8, password: []const u8, salt: []const u8, rounds: u32, comptime Prf: type) WeakParametersError || OutputTooLongError!void
Apply PBKDF2 to generate a key from a password.
PBKDF2 is defined in RFC 2898, and is a recommendation of NIST SP 800-132.
dk: Slice of appropriate size for generated key. Generally 16 or 32 bytes in length. May be uninitialized. All bytes will be overwritten. Maximum size is maxInt(u32) * Hash.digest_length
It is a programming error to pass buffer longer than the maximum size.
password: Arbitrary sequence of bytes of any length, including empty.
salt: Arbitrary sequence of bytes of any length, including empty. A common length is 8 bytes.
rounds: Iteration count. Must be greater than 0. Common values range from 1,000 to 100,000. Larger iteration counts improve security by increasing the time required to compute the dk. It is common to tune this parameter to achieve approximately 100ms.
Prf: Pseudo-random function to use. A common choice is std.crypto.auth.hmac.sha2.HmacSha256
.