diff options
author | Mattias Andrée <maandree@kth.se> | 2022-02-19 10:54:34 +0100 |
---|---|---|
committer | Mattias Andrée <maandree@kth.se> | 2022-02-19 10:54:34 +0100 |
commit | ffc17816a5b82eef5c136f409df3313742b25ff9 (patch) | |
tree | 26941b0271578e9cf15b7bb27e021b178ae2ec1f /libblake_blake384_digest_get_required_input_size.c | |
parent | Add some documentation, add const, and make some functions inline (diff) | |
download | libblake-ffc17816a5b82eef5c136f409df3313742b25ff9.tar.gz libblake-ffc17816a5b82eef5c136f409df3313742b25ff9.tar.bz2 libblake-ffc17816a5b82eef5c136f409df3313742b25ff9.tar.xz |
Add document BLAKE functions and make two functions inline
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to 'libblake_blake384_digest_get_required_input_size.c')
-rw-r--r-- | libblake_blake384_digest_get_required_input_size.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/libblake_blake384_digest_get_required_input_size.c b/libblake_blake384_digest_get_required_input_size.c index 23bdda2..b9737b0 100644 --- a/libblake_blake384_digest_get_required_input_size.c +++ b/libblake_blake384_digest_get_required_input_size.c @@ -4,5 +4,11 @@ size_t libblake_blake384_digest_get_required_input_size(size_t len, size_t bits, const char *suffix) { - return libblake_blake512_digest_get_required_input_size(len, bits, suffix); + bits += suffix ? strlen(suffix) : 0; + len += bits >> 3; + bits &= 7; + bits += (len & 127) << 3; + len &= ~(size_t)127; + len += (size_t)128 << (bits >= 1024 - (1 + 2 * 64)); + return len; } |