alcedo/kernel/arch/i386/hash.nim

13 lines
330 B
Nim
Raw Normal View History

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