Show HN: Hash any comparable type in Go

pkg.go.dev

1 points by paurea 8 hours ago

It can be used to write your own generic hash table, see for an example: https://pkg.go.dev/gitlab.eif.urjc.es/paurea/cuckoo

In contrast to https://github.com/dolthub/maphash it can use any hash function (as long as it implements hash.Hash64) and it does not depend on any internal detail of the runtime. It works by inspecting the type and creating the hasher to be used later. One of the types defined lets you also hash non-comparable types (ignoring the non-comparable part).