Hash module

fnv1a_hash

procedure2 overloadsSource

One step of 64-bit FNV-1a: mixes val into the hash h.

fnv1a_hash :: (val: u64, h := FNV_64_OFFSET_BIAS) -> u64

Parameters

val: u64

Returns

u64
Example↗
h := fnv1a_hash(1);
assert(h != fnv1a_hash(2));
assert(fnv1a_hash(2, h) != h);
fnv1a_hash :: (data: *void, size: int, h := FNV_64_OFFSET_BIAS) -> u64

A 64-bit FNV-1a hash of size bytes at data. Pass a previous result as h to continue it.

Parameters

data: *void
size: int

Returns

u64
Example↗
text := "jacket";
assert(fnv1a_hash(text.data, text.count) == fnv1a_hash(text.data, text.count));

See also