Hash functions now accept an option set
- This avoids having multiple `init()` functions for every combination of optional parameters - The API is consistent across all hash functions - New options can be added later without breaking existing applications. For example, this is going to come in handy if we implement parallelization for BLAKE2 and BLAKE3. - We don't have a mix of snake_case and camelCase functions any more, at least in the public crypto API Support for BLAKE2 salt and personalization (more commonly called context) parameters have been implemented by the way to illustrate this.
This commit is contained in:
@@ -112,7 +112,7 @@ test "issue #4532: no index out of bounds" {
|
||||
var block = [_]u8{'#'} ** Hasher.block_length;
|
||||
var out1: [Hasher.digest_length]u8 = undefined;
|
||||
var out2: [Hasher.digest_length]u8 = undefined;
|
||||
const h0 = Hasher.init();
|
||||
const h0 = Hasher.init(.{});
|
||||
var h = h0;
|
||||
h.update(block[0..]);
|
||||
h.final(out1[0..]);
|
||||
|
||||
Reference in New Issue
Block a user