Go hash/maphash: hash functions for hash tables
Answer: Package maphash provides hash functions on byte sequences and comparable values.
Intended uses
The hash functions are not cryptographically secure.
They are meant for hash tables, Bloom filters, and similar structures.
They map strings or byte sequences to a uniform distribution on unsigned 64-bit integers.
Hasher is the interface between a hash function and a hash table.
Seeds and safety
Each different instance of a hash table should use its own Seed.
The zero Hash is a valid Hash ready to use.
A Hash is not safe for concurrent use by multiple goroutines, but a Seed is.
See also
Claims
- id: C1 claim: Package maphash provides hash functions on byte sequences and comparable values. source: S1 evidence: "hash functions on byte sequences and comparable values"
- id: C2 claim: The hash functions are not cryptographically secure. source: S1 evidence: "The hash functions are not cryptographically secure"
- id: C3 claim: Each different instance of a hash table should use its own Seed. source: S2 evidence: "Each different instance of a hash table or data structure should use its own"
- id: C4 claim: The hash functions are not cryptographically secure. source: S2 evidence: "The hash functions are not cryptographically secure"
Sources
- [S1] hash/maphash. The Go Authors. https://pkg.go.dev/hash/maphash . License: BSD-3-Clause. Accessed 2026-11-26.
- [S2] hash/maphash source. The Go Authors. https://go.dev/src/hash/maphash/maphash.go . License: BSD-3-Clause. Accessed 2026-11-26.
License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources: The Go Authors, hash/maphash; The Go Authors, hash/maphash source. BSD-3-Clause (https://go.dev/LICENSE). Copyright The Go Authors. Text was condensed and changed from the originals.
License: CC-BY-4.0 · Summary by iinventedlight (AI-assisted). Sources: The Go Authors, hash/maphash; The Go Authors, hash/maphash source. BSD-3-Clause (https://go.dev/LICENSE). Copyright The Go Authors.
Cite this
iinventedlight. 2026. "Go hash/maphash: hash functions for hash tables." iinventedlight Library, iil:note:kgrrea8m, version of 2026-11-26. https://iinventedlight.com/library/notes/go-maphash/. License: CC-BY-4.0.
@misc{iil_note_kgrrea8m,
author = {{iinventedlight}},
title = {{Go hash/maphash: hash functions for hash tables}},
howpublished = {iinventedlight Library},
year = {2026},
date = {2026-11-26},
url = {https://iinventedlight.com/library/notes/go-maphash/},
note = {Permanent ID iil:note:kgrrea8m. License: CC-BY-4.0.},
}
Spotted a mistake? Use the MCP feedback tool or email hello@iinventedlight.com. Or Report a correction (no account needed).
Extra files beside this note
These files use this note's license, shown below. Paper extras retain their reproduction status; a link is not a reproduction.
- go-maphash.schema.json (schema; CC-BY-4.0)
- go-maphash.table.json (table; CC-BY-4.0)
For language models and agents: start at /llms.txt | /agents.md | /.well-known/agent-library.json. This page in Markdown: /library/notes/go-maphash.md.