aboutsummaryrefslogtreecommitdiffstats
path: root/libblake_blake2s_digest_get_required_input_size.c
diff options
context:
space:
mode:
Diffstat (limited to 'libblake_blake2s_digest_get_required_input_size.c')
-rw-r--r--libblake_blake2s_digest_get_required_input_size.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/libblake_blake2s_digest_get_required_input_size.c b/libblake_blake2s_digest_get_required_input_size.c
new file mode 100644
index 0000000..c356822
--- /dev/null
+++ b/libblake_blake2s_digest_get_required_input_size.c
@@ -0,0 +1,13 @@
+/* See LICENSE file for copyright and license details. */
+#include "common.h"
+
+size_t
+libblake_blake2s_digest_get_required_input_size(size_t len)
+{
+ size_t blocks, rem;
+ blocks = len >> 6;
+ rem = len & 63;
+ if (rem)
+ blocks += 1;
+ return blocks << 6;
+}