FNV-1a string hashing, homed on the Hash class.
Hash(Hash fnv-1a s)Hash a string to a word using the FNV-1a algorithm: FNV-1a 64 on an 8-byte word, FNV-1a 32 on a 4-byte word.
Parameters:
STRING — String to hashReturns: INTEGER — The FNV-1a hash, the word’s width
Examples:
(= (Hash fnv-1a "a") (Hash fnv-1a "a")) => #t
(str=? (Hash ->hex (Hash fnv-1a "")) (if (< %word-size 8) "811c9dc5" "cbf29ce484222325")) => #t(Hash ->hex n)Convert a word to its unsigned hex string, two digits a byte: 16 on an 8-byte word, 8 on a 4-byte word.
Parameters:
INTEGER — A word, such as a hashReturns: STRING — The word’s bits in hexadecimal
Examples:
(str=? (Hash ->hex 255) (if (< %word-size 8) "000000ff" "00000000000000ff")) => #t
(= (Str8 length (Hash ->hex -1)) (* 2 %word-size)) => #t