Skip to content

why2_sum_segment

Parameters

Identifier Data type
input char *

Attributes

Return type unsigned long long
Header comment CALCULATE SUM++ FOR input; USED FOR PADDING SEED
Added in commit fb2ac1a7bbcb6f7291f4e89576e1b7f5c1d6fd06

Description

Function takes input parameter and divides it into segments of WHY2_SUM_SEGMENT_SIZE. Each segment does some xoring, math using WHY2_SUM_BASE_PRIME and modulates each segment with WHY2_SUM_MOD_PRIME. The result is then added together and returned.

Output value grows rapidly with increasing input length, but unless you are using enormously large keys, nothing should overflow. Function was tested with lengths up to 4096 chars and output was only about 0,0000014 % of the ULL range.

This function isn't designed to be completely cryptographically secure! It is meant only for converting string of key into ULL with as few collisions as possible.