initKdf
Construct a new Blake3 for the key derivation function. The context
string should be hardcoded, globally unique, and application-specific.
Function parameters
Parameters
- context:[]const u8
An incremental hasher that can accept any number of writes.
Types
- Blake3
- An incremental hasher that can accept any number of writes.
Source
Implementation
pub fn initKdf(context: []const u8, options: KdfOptions) Blake3 {
_ = options;
var context_hasher = Blake3.init_internal(IV, DERIVE_KEY_CONTEXT);
context_hasher.update(context);
var context_key: [KEY_LEN]u8 = undefined;
context_hasher.final(context_key[0..]);
const context_key_words = wordsFromLittleEndianBytes(8, context_key);
return Blake3.init_internal(context_key_words, DERIVE_KEY_MATERIAL);
}