The FNVHash
structure provides an implementation of the
Fowler-Noll-Vo
(FNV) hashing algorithm (specifically the 64-bit FNV-1a algorithm).
Synopsis
structure FNVHash
Interface
val offsetBasis : Word64.word
val hashByte : Word8.word * Word64.word -> Word64.word
val hashChar : char * Word64.word -> Word64.word
val hashString : string -> word
val hashSubstring : substring -> word
Description
val offsetBasis : Word64.word
-
The
offsetBasis
should be used as the initial value when usinghashByte
and/orhashChar
to incrementally hash a data value. val hashByte : Word8.word * Word64.word -> Word64.word
-
hashByte (b, h)
computes one step of the FNV hashing algorithm for byteb
and initial hash valueh
. val hashChar : char * Word64.word -> Word64.word
-
hashByte (c, h)
computes one step of the FNV hashing algorithm for characterc
and initial hash valueh
. val hashString : string -> word
-
hashString s
returns the hash of the given string. It is equivalent to the expressionCharVector.foldl hashChar offsetBasis s
val hashSubstring : substring -> word
-
hashSubstring ss
returns the hash of the given substring. It is equivalent to the expressionSubstring.foldl hashChar offsetBasis ss