← All notes

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

Sources

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

Permanent ID: iil:note:kgrrea8m

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.},
}

Markdown

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.

All artifact files (JSON index)

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.