Frank Denis 26793453a7 std/crypto/blake2b: allow the initial output length to be set
BLAKE2 includes the expected output length in the initial state.

This length is actually distinct from the actual output length
used at finalization.

BLAKE2b-256/128 is thus not the same as BLAKE2b-128.

This behavior can be a little bit surprising, and has been "fixed"
in BLAKE3.

In order to support this, we may want to provide an option to set the
length used for domain separation.

In Zig, there is another reason to allow this: we assume that the
output length is defined at comptime.

But BLAKE2 doesn't have a fixed output length. For an output length that
is not known at comptime, we can't take the full block size and
truncate it due to the reason above.

What we can do now is set that length as an option to get the correct
initial state, and truncate the output if necessary.
2020-10-29 15:18:37 -04:00
..
2020-10-25 21:13:14 -04:00
2020-10-26 19:19:34 -04:00
2020-10-26 19:19:34 -04:00
2020-09-16 01:58:48 +03:00