xxhash

A pure-Go implementation of the 64-bit xxHash (XXH64) algorithm with hand-written amd64 and arm64 assembly for maximum throughput.

Library
Go
vv2.3.0
2,140stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
39/100Needs Attention
Development Activity0
Maintenance0
Community56
Maturity60
Momentum40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
84/100Excellent
Architecture80
Code Quality85
Innovation82
Learning Curve90

xxhash implements XXH64, the 64-bit variant of the xxHash non-cryptographic hashing algorithm, as a small, dependency-free Go module. The package exposes a minimal API — a one-shot Sum64/Sum64String pair plus a Digest type implementing hash.Hash64 for streaming writes — so it drops into existing Go code with almost no integration cost. On amd64 and arm64 it dispatches to hand-tuned assembly for a significant throughput boost over the pure-Go path, while a purego build tag keeps a portable fallback available for every other architecture.

Because it is fast, allocation-free, and has zero third-party dependencies, xxhash/v2 has become a default choice for internal hashing needs across the Go ecosystem — it is vendored or imported directly by projects like InfluxDB, Prometheus, VictoriaMetrics, Badger, and Ristretto for tasks such as cache-key generation, sharding, and checksum computation where cryptographic strength is unnecessary and speed is the priority.

What You Get

  • A Sum64(b []byte) uint64 and Sum64String(s string) uint64 pair for one-shot hashing with no setup
  • A Digest type implementing the standard library’s hash.Hash64 interface for streaming/incremental hashing
  • Hand-written amd64 and arm64 assembly implementations for maximum throughput, selected automatically at build time
  • A purego build tag that forces the portable pure-Go path on any architecture, including ones without assembly support
  • MarshalBinary/UnmarshalBinary support on Digest for persisting and resuming hash state
  • A small xxhsum CLI utility (in xxhsum/) for hashing files or stdin from the command line

Common Use Cases

  • Generating fast, well-distributed cache keys for in-memory or distributed caches
  • Computing checksums for data integrity checks where cryptographic security is not required
  • Sharding or partitioning keys across nodes based on a fast, uniform hash distribution
  • Deduplicating byte slices or strings in high-throughput data pipelines
  • Implementing custom hash-map or bloom-filter style structures that need a fast non-cryptographic hash function

Under The Hood

Architecture The package has a flat, single-package layout with no internal layering — xxhash.go holds the core algorithm state (Digest), the round/mergeRound helper functions, and the prime constants, while xxhash_asm.go and xxhash_other.go use Go build tags to select between assembly (xxhash_amd64.s, xxhash_arm64.s) and a portable Go implementation of the same two exported functions (Sum64, writeBlocks) at compile time — a build-tag dispatch pattern rather than a runtime branch, so choosing the fast path costs nothing at run time. The Digest struct carries only its four accumulator words, a small internal buffer, and a length counter, and both Write and Sum64 mutate this state directly with no heap allocations. Because the abstraction boundary is simply “these two functions must exist and agree,” changing the core hashing algorithm would require updating three parallel implementations — amd64 assembly, arm64 assembly, and the portable Go fallback — in lockstep.

Tech Stack go.mod declares Go 1.11 compatibility with zero external dependencies; the module targets amd64 and arm64 via hand-written Go assembly fed straight to the Go toolchain’s own assembler, with xxhash_unsafe.go using unsafe.Pointer for zero-copy string-to-byte conversion on supported platforms and xxhash_safe.go as the non-unsafe counterpart used elsewhere. CI runs go test -bench across recent Go versions on Linux, macOS, and Windows for native amd64/arm64, plus a QEMU-emulated matrix covering 386/arm/arm64 to validate the pure-Go path on architectures without hand-written assembly. There is no build system beyond the standard go build/go test; the only shipped binary is the small xxhsum CLI in its own subdirectory.

Code Quality Test files provide table-driven tests and benchmarks, and the CI matrix runs them under both the assembly and purego build tags to guarantee the fast and portable implementations stay bit-identical. Error handling is deliberately minimal — Write never fails, matching the hash.Hash contract — with errors reserved for MarshalBinary/UnmarshalBinary on malformed state. Naming follows standard-library hashing conventions (Sum64, Digest, Reset), and the internals favor small, individually documented helper functions over dense one-off code. No linter configuration is present, but the source is consistently gofmt-formatted and idiomatic.

API Design The public surface is intentionally tiny — two free functions (Sum64, Sum64String) plus one struct satisfying the standard library’s hash.Hash64 interface — so most callers need nothing beyond the package doc comment to get started, and existing code written against hash.Hash64 works unmodified. The build-tag-driven fast/portable dispatch and the purego escape hatch stay invisible to callers, so ergonomics never trade off against performance. The tradeoff is a narrow, unconfigurable scope: this package implements XXH64 only, not the newer XXH3 or 32-bit variants, so projects needing multiple hash families must reach for a different module.

Used by 18 apps in this directory

Rust
65%
Apache 2.0

agentgateway

AI Development · Developer Tools

4,640

An open source AI-native proxy that secures, observes, and governs agent-to-LLM, agent-to-tool, and agent-to-agent communication through MCP, A2A, and unified LLM routing.

View details
87
Repo Health
82
Technical
71
Dependency
Built with
Rust65%
Go23%
Updated 3 days ago
Go
98%
Apache 2.0

Caddy

Devops · Security

75,334

The only web server that obtains and renews TLS certificates automatically, with HTTP/1-2-3 support and zero dependency on external runtimes.

View details
92
Repo Health
86
Technical
76
Dependency
Built with
Go98%
Updated 2 days ago
Go
75%
AGPL 3.0

Coder

Devops · Developer Tools · Code Editors

14,299

Self-hosted cloud development environments and AI coding agents — defined in Terraform, connected via WireGuard, automatically shut down when idle.

View details
93
Repo Health
90
Technical
69
Dependency
Built with
Go75%
TypeScript23%
Updated today
Go
79%
Apache 2.0

Dolt

Databases · Data Engineering · Developer Tools

24,298

The SQL database you can branch, merge, diff, and clone — Git for your data, MySQL-compatible and ready for multi-agent AI workflows.

View details
90
Repo Health
9
Technical
67
Dependency
Built with
Go79%
Shell20%
Updated 2 days ago
Go
73%
Other

Flipt

Devops · Developer Tools

4,884

Git-native feature flag platform that stores, versions, and deploys feature toggles directly in your own Git repositories with no external database required.

View details
89
Repo Health
83
Technical
70
Dependency
Built with
Go73%
TypeScript26%
Updated yesterday
TypeScript
49%
AGPL 3.0

Grafana

Monitoring · Analytics

76,498

The open-source observability platform that unifies metrics, logs, and traces from any data source into dynamic, queryable dashboards.

View details
95
Repo Health
91
Technical
65
Dependency
Built with
TypeScript49%
Go45%
Updated today
TypeScript
51%
Other

Mattermost

Team Chat · Collaboration · Devops

38,940

Open core, self-hosted team collaboration with chat, AI agents, voice calling, and deep DevOps integrations — all under your control.

View details
96
Repo Health
87
Technical
65
Dependency
Built with
TypeScript51%
Go40%
Updated yesterday
Go
99%
AGPL 3.0

MinIO

File Storage

61,375

High-performance, S3-compatible object storage built for AI/ML and analytics workloads — run it anywhere from a laptop to a petabyte-scale cluster.

View details
60
Repo Health
85
Technical
66
Dependency
Built with
Go99%
Updated 4 months ago
Go
44%
GPL 3.0

Netdata

Monitoring · Devops

80,357

Real-time per-second metrics, ML-powered anomaly detection, and zero-config observability for any infrastructure.

View details
93
Repo Health
86
Technical
71
Dependency
Built with
Go44%
C32%
Rust15%
Updated today

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search