2018-05-01 19:24:29 +01:00
|
|
|
const
|
|
|
|
FNVPrime = 16777619'u32
|
|
|
|
FNVOffsetBasis = 0x811c9dc5'u32
|
|
|
|
|
|
|
|
proc fnv1a*(data: varargs[uint8]): uint32 =
|
|
|
|
result = FNVOffsetBasis
|
|
|
|
for i in data:
|
|
|
|
result = result xor i
|
2018-05-16 02:05:07 +01:00
|
|
|
result = result * FNVPrime
|
|
|
|
|
|
|
|
proc fnv1aCompound*(base: uint32, addition: uint8): uint32 =
|
|
|
|
result = base xor addition
|
|
|
|
result = result * FNVPrime
|