# zeebo/xxh3 architecture

> Architecture diagram of the GitHub repository zeebo/xxh3, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-26). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/zeebo/xxh3
- Repository: https://github.com/zeebo/xxh3

## Overview

XXH3 is a Go hashing library that returns 64- or 128-bit digests, with seeded and streaming APIs. Callers provide bytes or strings to a one-shot API, or write chunks to a stateful hasher and request a digest. The one-shot paths specialize by input length; long inputs use scalar or architecture-specific accumulation. The streaming implementation also dispatches accumulation by available CPU features. SIMD assembly-generation sources are shown separately from runtime kernels; their internal wiring was not inspected.

Main entry points: [`hash64.go`](https://github.com/zeebo/xxh3/blob/master/hash64.go) (64-bit hash), [`accum_generic.go`](https://github.com/zeebo/xxh3/blob/master/accum_generic.go) (Scalar accumulation), [`hasher.go`](https://github.com/zeebo/xxh3/blob/master/hasher.go) (Streaming hasher), [`hash64_seed.go`](https://github.com/zeebo/xxh3/blob/master/hash64_seed.go) (Seeded 64-bit)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["Hash APIs"]
  node_hash64["64-bit hash<br/>[hash64.go]"]
  node_hash64seed["Seeded 64-bit<br/>[hash64_seed.go]"]
  node_hash128["128-bit hash<br/>[hash128.go]"]
  node_hash128seed["Seeded 128-bit<br/>[hash128_seed.go]"]
end

subgraph group_stream["Streaming Hash"]
  node_hasher["Streaming hasher<br/>[hasher.go]"]
  node_hasher128["Streaming 128-bit<br/>[hasher128.go]"]
end

subgraph group_compute["Accumulation"]
  node_scalar["Scalar accumulation<br/>[accum_generic.go]"]
  node_sse["SSE kernels"]
  node_avx["AVX kernels"]
  node_avx512["AVX-512 kernels"]
  node_neon["NEON kernels"]
  node_avxgen["AVX generator<br/>[avx.go]"]
end

node_caller(("Library caller"))
node_output["Digest value"]

node_caller -->|"provides input"| node_hash64
node_caller -->|"provides input"| node_hash64seed
node_caller -->|"provides input"| node_hash128
node_caller -->|"provides input"| node_hash128seed
node_caller -->|"writes chunks"| node_hasher
node_hash64 -->|"accumulates long input"| node_scalar
node_hash64seed -->|"accumulates long input"| node_scalar
node_hash128 -->|"accumulates long input"| node_scalar
node_hash128seed -->|"accumulates long input"| node_scalar
node_hash64 -->|"dispatches SIMD"| node_sse
node_hash64 -->|"dispatches SIMD"| node_avx
node_hash64 -->|"dispatches SIMD"| node_avx512
node_hash64 -->|"dispatches SIMD"| node_neon
node_hasher -->|"accumulates chunks"| node_scalar
node_hasher -->|"supports 128-bit sum"| node_hasher128
node_hasher -->|"returns digest"| node_output
node_hasher128 -.->|"returns digest"| node_output
node_hash64 -->|"returns digest"| node_output
node_hash64seed -->|"returns digest"| node_output
node_hash128 -->|"returns digest"| node_output
node_hash128seed -->|"returns digest"| node_output

click node_hash64 "https://github.com/zeebo/xxh3/blob/master/hash64.go"
click node_hash64seed "https://github.com/zeebo/xxh3/blob/master/hash64_seed.go"
click node_hash128 "https://github.com/zeebo/xxh3/blob/master/hash128.go"
click node_hash128seed "https://github.com/zeebo/xxh3/blob/master/hash128_seed.go"
click node_hasher "https://github.com/zeebo/xxh3/blob/master/hasher.go"
click node_hasher128 "https://github.com/zeebo/xxh3/blob/master/hasher128.go"
click node_scalar "https://github.com/zeebo/xxh3/blob/master/accum_generic.go"
click node_sse "https://github.com/zeebo/xxh3/blob/master/accum_vector_sse_amd64.s"
click node_avx "https://github.com/zeebo/xxh3/blob/master/accum_vector_avx_amd64.s"
click node_avx512 "https://github.com/zeebo/xxh3/blob/master/accum_vector_avx512_amd64.s"
click node_neon "https://github.com/zeebo/xxh3/blob/master/accum_vector_neon_arm64.s"
click node_avxgen "https://github.com/zeebo/xxh3/blob/master/avo/avx.go"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_hash64,node_hash64seed,node_hash128,node_hash128seed toneBlue
class node_hasher,node_hasher128 toneAmber
class node_scalar,node_sse,node_avx,node_avx512,node_neon,node_avxgen toneMint
class node_caller,node_output toneIndigo
```

## Components

### Hash APIs

- [64-bit hash](https://github.com/zeebo/xxh3/blob/master/hash64.go): `hash64.go`
- [Seeded 64-bit](https://github.com/zeebo/xxh3/blob/master/hash64_seed.go): `hash64_seed.go`
- [128-bit hash](https://github.com/zeebo/xxh3/blob/master/hash128.go): `hash128.go`
- [Seeded 128-bit](https://github.com/zeebo/xxh3/blob/master/hash128_seed.go): `hash128_seed.go`

### Streaming Hash

- [Streaming hasher](https://github.com/zeebo/xxh3/blob/master/hasher.go): `hasher.go`
- [Streaming 128-bit](https://github.com/zeebo/xxh3/blob/master/hasher128.go): `hasher128.go`

### Accumulation

- [Scalar accumulation](https://github.com/zeebo/xxh3/blob/master/accum_generic.go): `accum_generic.go`
- [SSE kernels](https://github.com/zeebo/xxh3/blob/master/accum_vector_sse_amd64.s): `accum_vector_sse_amd64.s`
- [AVX kernels](https://github.com/zeebo/xxh3/blob/master/accum_vector_avx_amd64.s): `accum_vector_avx_amd64.s`
- [AVX-512 kernels](https://github.com/zeebo/xxh3/blob/master/accum_vector_avx512_amd64.s): `accum_vector_avx512_amd64.s`
- [NEON kernels](https://github.com/zeebo/xxh3/blob/master/accum_vector_neon_arm64.s): `accum_vector_neon_arm64.s`
- [AVX generator](https://github.com/zeebo/xxh3/blob/master/avo/avx.go): `avo/avx.go`

### Other components

- **Library caller**
- **Digest value**

## Connections

- Library caller → 64-bit hash: provides input (evidence: `hash64.go`)
- Library caller → Seeded 64-bit: provides input (evidence: `hash64_seed.go`)
- Library caller → 128-bit hash: provides input (evidence: `hash128.go`)
- Library caller → Seeded 128-bit: provides input (evidence: `hash128_seed.go`)
- Library caller → Streaming hasher: writes chunks (evidence: `hasher.go`)
- 64-bit hash → Scalar accumulation: accumulates long input (evidence: `hash64.go`)
- Seeded 64-bit → Scalar accumulation: accumulates long input (evidence: `hash64_seed.go`)
- 128-bit hash → Scalar accumulation: accumulates long input (evidence: `hash128.go`)
- Seeded 128-bit → Scalar accumulation: accumulates long input (evidence: `hash128_seed.go`)
- 64-bit hash → SSE kernels: dispatches SIMD (evidence: `hash64.go`)
- 64-bit hash → AVX kernels: dispatches SIMD (evidence: `hash64.go`)
- 64-bit hash → AVX-512 kernels: dispatches SIMD (evidence: `hash64.go`)
- 64-bit hash → NEON kernels: dispatches SIMD (evidence: `hash64.go`)
- Streaming hasher → Scalar accumulation: accumulates chunks (evidence: `hasher.go`)
- Streaming hasher → Streaming 128-bit: supports 128-bit sum (evidence: `hasher.go`)
- Streaming hasher → Digest value: returns digest (evidence: `hasher.go`)
- Streaming 128-bit → Digest value: returns digest
- 64-bit hash → Digest value: returns digest (evidence: `hash64.go`)
- Seeded 64-bit → Digest value: returns digest (evidence: `hash64_seed.go`)
- 128-bit hash → Digest value: returns digest (evidence: `hash128.go`)
- Seeded 128-bit → Digest value: returns digest (evidence: `hash128_seed.go`)
