Charon.Utils.KeyGenerator (Charon v4.2.0)
View SourceDerive a key from a base secret using PBKDF2.
Summary
Functions
Derive a new key from base_secret using salt.
Types
@type opts() :: [ length: pos_integer(), iterations: pos_integer(), digest: :sha | :sha224 | :sha256 | :sha384 | :sha512, log: false | :debug | :info | :warning | :error ]
Functions
Derive a new key from base_secret using salt.
Options
:lengthkey length in bytes, default 32 (256 bits):iterationshash iterations to derive new key, default 250_000:digesthashing algorithm used as pseudo-random function, default:sha256:loglog level for this operation (default:warning), orfalseto disable logging. Logging helps identify call sites that may need caching after the v4 breaking change removed the built-in cache.
Doctests
iex> derive_key("secret", "salt", length: 5, iterations: 1)
<<56, 223, 66, 139, 48>>