ddn.api.crypto.kdf

Key Derivation Function (KDF) API.

struct KDFParams
iface KDF

Types 2

structKDFParams

Optional parameters for key derivation algorithms.

Not all fields are relevant to every KDF. Implementations should use the fields that apply and ignore the rest.

Fields
uint iterationsNumber of iterations (PBKDF2, Argon2). Default: 1.
uint memoryMemory cost in KiB (Argon2). Default: 0 (use algorithm default).
uint parallelismDegree of parallelism (Argon2). Default: 1.
const(ubyte)[] infoContext and application-specific information (HKDF). Default: null.
interfaceKDF

Interface for Key Derivation Functions.

KDFs derive cryptographic keys from a secret (e.g., password) and a salt.

Methods
ubyte[] derive(const(ubyte)[] secret, const(ubyte)[] salt, size_t length)Derives a key of the specified length using default parameters.
ubyte[] derive(const(ubyte)[] secret, const(ubyte)[] salt, size_t length, KDFParams params)Derives a key of the specified length using the given parameters.