Documentation
¶
Overview ¶
Package hashutils provides utilities for hashing objects in a stable way. The hash returned should be considered stable when a hasher is provided. If a hasher is not provided, the default hasher is used, which is currently xxhash, but may change resulting in different hashes. It is OK to use the default hasher for temporary hashes, but for long-term storage, a specific hasher should be provided. The hash returned is a 64-bit non-cryptographic hash.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HashAny ¶
HashAny hashes an arbitrary Go value (the result of json.Unmarshal) in a canonical way using the provided hasher. It returns a 64-bit non-cryptographic hash.
func HashJSON ¶
HashJSON takes a blob of JSON, unmarshals it, and returns a 64-bit hash using the provided hasher. If there's an error unmarshaling, it returns 0 and the error.