zig/lib/std/crypto
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
..
25519
aes
aegis.zig
aes.zig
aes_gcm.zig
bcrypt.zig
benchmark.zig
blake2.zig std/crypto/blake2b: allow the initial output length to be set 2020-10-29 15:18:37 -04:00
blake3.zig
chacha20.zig
ghash.zig
gimli.zig
hkdf.zig
hmac.zig
md5.zig
modes.zig
pbkdf2.zig
poly1305.zig
salsa20.zig
sha1.zig
sha2.zig
sha3.zig
siphash.zig
test.zig