aboutsummaryrefslogblamecommitdiffstats
path: root/libblake_blake512_digest_get_required_input_size.c
blob: 46c2cb13d2bd54297fc68fa5f0b9c2945159a9db (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15














                                                                                             
/* See LICENSE file for copyright and license details. */
#include "common.h"

size_t
libblake_blake512_digest_get_required_input_size(size_t len, size_t bits, const char *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;
}