Hacker News

paurea
Show HN: Hash any comparable type in Go pkg.go.dev

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).


hn-front (c) 2024 voximity
source