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
offsetBasisshould be used as the initial value when usinghashByteand/orhashCharto 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 byteband initial hash valueh. val hashChar : char * Word64.word -> Word64.word-
hashByte (c, h)computes one step of the FNV hashing algorithm for charactercand initial hash valueh. val hashString : string -> word-
hashString sreturns the hash of the given string. It is equivalent to the expressionCharVector.foldl hashChar offsetBasis s val hashSubstring : substring -> word-
hashSubstring ssreturns the hash of the given substring. It is equivalent to the expressionSubstring.foldl hashChar offsetBasis ss