On Wednesday, June 25, 2025 at 5:25:51 PM UTC+2 Pierre Durand wrote: Is it safe to use the result of a hash/maphash (uint64) as a map key. Is there a risk of collision ? (different inputs generate the same hash)
Thank you Hi Pierre, If it helps, I usually just cryptographically hash the key (e.g. with Blake3, a very fast hash both with and without hardware support), and turn a prefix of that hash (I typically use 33 bytes or 264 bits; has negligible chance of collision) into the string key of a built in map. For example, https://github.com/glycerine/rpc25519/blob/master/hash/blake3.go#L104 - Jason -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion visit https://groups.google.com/d/msgid/golang-nuts/c9da260d-9779-43d8-b5ff-70bbffb5d837n%40googlegroups.com.