diff options
author | Mattias Andrée <maandree@kth.se> | 2022-01-07 19:52:35 +0100 |
---|---|---|
committer | Mattias Andrée <maandree@kth.se> | 2022-01-07 20:21:49 +0100 |
commit | 6adc0e6c6c378b5438533bdf55636ef049c1b956 (patch) | |
tree | ea55a4f54d7d190a1634c0a7ec8054fa2cdf47fd /libblake_blake2b_digest_get_required_input_size.c | |
parent | libblake_decode_hex: verify input (diff) | |
download | libblake-6adc0e6c6c378b5438533bdf55636ef049c1b956.tar.gz libblake-6adc0e6c6c378b5438533bdf55636ef049c1b956.tar.bz2 libblake-6adc0e6c6c378b5438533bdf55636ef049c1b956.tar.xz |
Add BLAKE2b and BLAKE2s + add salt support to BLAKE + m
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to 'libblake_blake2b_digest_get_required_input_size.c')
-rw-r--r-- | libblake_blake2b_digest_get_required_input_size.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/libblake_blake2b_digest_get_required_input_size.c b/libblake_blake2b_digest_get_required_input_size.c new file mode 100644 index 0000000..12288df --- /dev/null +++ b/libblake_blake2b_digest_get_required_input_size.c @@ -0,0 +1,13 @@ +/* See LICENSE file for copyright and license details. */ +#include "common.h" + +size_t +libblake_blake2b_digest_get_required_input_size(size_t len) +{ + size_t blocks, rem; + blocks = len >> 7; + rem = len & 127; + if (rem) + blocks += 1; + return blocks << 7; +} |