keen/hash

Source
This is a standard module and does not need to be explicitly imported.

Functions for getting hash codes.

Hash codes are used internally by map and set types, which require a hash implementation for the key type.

sorted-key[k] spec k data, k compare
Spec for types that can be used as keys in sorted collections that don't need hashing.
key[k] spec k sorted-key, k hash
Spec for types that can be used as keys in any map or set.
hash[t] spec
hash void(a t, state hash-state)

Spec that should be implemented for any type used as a map key.

hash on a composite type (such as a record or collection) usually just calls hash for each value it contains.

hash on a union should mix a number or name for the union member, then mix its associated value, if any.

seeded-hash[t] nat64(a t) global, t hash
Get a hash code based on a global random seed. This will return the same value given the same argument in the same process, but will be different for each new process.
deterministic-hash[t] nat64(a t) t hash
Get a deterministic hash code for any value.
hash-state record (has private fields)
new hash-state()
new hash-state(seed nat64)
finish nat64(a hash-state)
hash void(_ void, _ hash-state)
hash void(a bool, state hash-state)
hash void(a nat8, state hash-state)
hash void(a nat16, state hash-state)
hash void(a nat32, state hash-state)
hash void(a nat64, state hash-state)
hash void(a int8, state hash-state)
hash void(a int16, state hash-state)
hash void(a int32, state hash-state)
hash void(a int64, state hash-state)
hash void(a float32, state hash-state)
hash void(a float64, state hash-state)
hash[t, u] void((t t, u u), state hash-state) t hash, u hash