You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
tailscale/util/deephash
Joe Tsai 60657ac83f
util/deephash: tighten up SelfHasher API (#11012)
Providing a hash.Block512 is an implementation detail of how deephash
works today, but providing an opaque type with mostly equivalent API
(i.e., HashUint8, HashBytes, etc. methods) is still sensible.
Thus, define a public Hasher type that exposes exactly the API
that an implementation of SelfHasher would want to call.
This gives us freedom to change the hashing algorithm of deephash
at some point in the future.

Also, this type is likely going to be called by types that are
going to memoize their own hash results, we additionally add
a HashSum method to simplify this use case.

Add documentation to SelfHasher on how a type might implement it.

Updates: corp#16409

Signed-off-by: Joe Tsai <joetsai@digital-static.net>
8 months ago
..
testtype all: update copyright and license headers 2 years ago
debug.go all: update copyright and license headers 2 years ago
deephash.go util/deephash: tighten up SelfHasher API (#11012) 8 months ago
deephash_test.go util/deephash: tighten up SelfHasher API (#11012) 8 months ago
pointer.go all: update copyright and license headers 2 years ago
pointer_norace.go all: update copyright and license headers 2 years ago
pointer_race.go all: update copyright and license headers 2 years ago
types.go util/deephash: tighten up SelfHasher API (#11012) 8 months ago
types_test.go util/deephash: tighten up SelfHasher API (#11012) 8 months ago