fnv

This package implements the Fowler-Noll-Vo hash function, revisions 1 and 1A (usually called FNV-1 and FNV-1a, respectively). The 32, 64, and 128-bit variants of both functions are currently available.

FNV-0 is not included in this package, as it is deprecated and highly ineffective in comparison to its counterparts.

The FNV hash functions are non-cryptographic. They should not be used for anything where security is of concern.

128-bit hashes in this library use the stint nimble package.

Types

FnvHashable = concept x
    ## Concept over any type that can be used to generate
    ## an FNV hash. Anything that can be iterated over in
    ## a for loop, giving elements that can be casted to
    ## uint8, will fulfill this concept. This includes
    ## strings, arrays, openArrays, seqs, etc. as long
    ## as the elements can be casted to uint8.
    for c in x:
      c.uint8 is uint8

Funcs

func fnv1a_32(x: FnvHashable): uint32
Produce a 32-bit FNV-1a hash. x is of the concept FnvHashable, described above.
func fnv1a_64(x: FnvHashable): uint64
Produce a 64-bit FNV-1a hash. x is of the concept FnvHashable, described above.
func fnv1a_128(x: FnvHashable): UInt128
Produce a 128-bit FNV-1 hash. The return type is 'UInt128' from the stint nimble package.
func fnv1_32(x: FnvHashable): uint32
Produce a 32-bit FNV-1 hash. x is of the concept FnvHashable, described above.
func fnv1_64(x: FnvHashable): uint64
Produce a 64-bit FNV-1 hash. x is of the concept FnvHashable, described above.
func fnv1_128(x: FnvHashable): UInt128
Produce a 128-bit FNV-1 hash. The return type is 'UInt128' from the stint nimble package.