# robby031/axhash architecture

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

- Interactive diagram: https://gitdiagram.com/robby031/axhash
- Repository: https://github.com/robby031/axhash

## Overview

AxHash is a deterministic, high-performance hashing library for Rust and native systems languages. The main workflow is a Rust caller using the workspace facade or core API to hash bytes or values; the hasher dispatches byte processing to a scalar or supported SIMD backend and returns a 64-bit hash. The core also exposes seeded hashing, BuildHasher integration, and runtime SIMD reporting; the workspace documents a stable C ABI. The graph reflects shown imports and README claims; the FFI-to-core implementation link is left unverified because its source excerpt does not show it.

Main entry points: [`crates/axhash-core/src/backend/scalar.rs`](https://github.com/robby031/axhash/blob/main/crates/axhash-core/src/backend/scalar.rs) (Scalar backend), [`crates/axhash-core/src/math.rs`](https://github.com/robby031/axhash/blob/main/crates/axhash-core/src/math.rs) (Hash arithmetic), [`crates/axhash-core/src/backend/mod.rs`](https://github.com/robby031/axhash/blob/main/crates/axhash-core/src/backend/mod.rs) (Backend dispatch), [`crates/axhash-core/src/backend/aarch64.rs`](https://github.com/robby031/axhash/blob/main/crates/axhash-core/src/backend/aarch64.rs) (NEON backend)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_rust["Rust interface"]
  node_facade["Crate facade<br/>[lib.rs]"]
  node_api["Hash API<br/>[api.rs]"]
  node_build["BuildHasher<br/>[build.rs]"]
end

subgraph group_engine["Hashing engine"]
  node_state["Hasher state<br/>[core.rs]"]
  node_trait["Hasher interface<br/>[trait_impl.rs]"]
  node_dispatch["Backend dispatch<br/>[mod.rs]"]
  node_scalar["Scalar backend<br/>[scalar.rs]"]
  node_x86["AVX2 backend<br/>[x86_64.rs]"]
  node_arm["NEON backend<br/>[aarch64.rs]"]
  node_math["Hash arithmetic<br/>[math.rs]"]
  node_memory["Memory loads<br/>[memory.rs]"]
  node_constants["Hash constants<br/>[constants.rs]"]
end

subgraph group_native["Native interface"]
  node_ffi["C ABI<br/>[lib.rs]"]
end

node_caller(("Rust caller"))
node_c_caller(("C caller"))

node_caller -->|"uses"| node_facade
node_facade -->|"re-exports"| node_api
node_api -->|"dispatches"| node_dispatch
node_api -->|"uses"| node_math
node_build -->|"uses"| node_math
node_state -->|"uses"| node_math
node_trait -->|"implements"| node_state
node_trait -->|"dispatches"| node_dispatch
node_trait -->|"uses"| node_math
node_dispatch -->|"dispatches"| node_scalar
node_dispatch -->|"dispatches"| node_x86
node_dispatch -->|"dispatches"| node_arm
node_scalar -->|"uses"| node_math
node_scalar -->|"loads via"| node_memory
node_scalar -->|"uses"| node_constants
node_x86 -->|"shares helpers"| node_scalar
node_x86 -->|"uses"| node_constants
node_arm -->|"shares helpers"| node_scalar
node_arm -->|"loads via"| node_memory
node_arm -->|"uses"| node_constants
node_math -->|"uses"| node_constants
node_c_caller -->|"calls"| node_ffi
node_ffi -.->|"uses core"| node_api

click node_facade "https://github.com/robby031/axhash/blob/main/src/lib.rs"
click node_api "https://github.com/robby031/axhash/blob/main/crates/axhash-core/src/hasher/api.rs"
click node_build "https://github.com/robby031/axhash/blob/main/crates/axhash-core/src/hasher/build.rs"
click node_state "https://github.com/robby031/axhash/blob/main/crates/axhash-core/src/hasher/core.rs"
click node_trait "https://github.com/robby031/axhash/blob/main/crates/axhash-core/src/hasher/trait_impl.rs"
click node_dispatch "https://github.com/robby031/axhash/blob/main/crates/axhash-core/src/backend/mod.rs"
click node_scalar "https://github.com/robby031/axhash/blob/main/crates/axhash-core/src/backend/scalar.rs"
click node_x86 "https://github.com/robby031/axhash/blob/main/crates/axhash-core/src/backend/x86_64.rs"
click node_arm "https://github.com/robby031/axhash/blob/main/crates/axhash-core/src/backend/aarch64.rs"
click node_math "https://github.com/robby031/axhash/blob/main/crates/axhash-core/src/math.rs"
click node_memory "https://github.com/robby031/axhash/blob/main/crates/axhash-core/src/memory.rs"
click node_constants "https://github.com/robby031/axhash/blob/main/crates/axhash-core/src/constants.rs"
click node_ffi "https://github.com/robby031/axhash/blob/main/crates/axhash-ffi/src/lib.rs"

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_facade,node_api,node_build toneBlue
class node_state,node_trait,node_dispatch,node_scalar,node_x86,node_arm,node_math,node_memory,node_constants toneAmber
class node_ffi toneMint
class node_caller,node_c_caller toneIndigo
```

## Components

### Rust interface

- [Crate facade](https://github.com/robby031/axhash/blob/main/src/lib.rs): `src/lib.rs`
- [Hash API](https://github.com/robby031/axhash/blob/main/crates/axhash-core/src/hasher/api.rs): `crates/axhash-core/src/hasher/api.rs`
- [BuildHasher](https://github.com/robby031/axhash/blob/main/crates/axhash-core/src/hasher/build.rs): `crates/axhash-core/src/hasher/build.rs`

### Hashing engine

- [Hasher state](https://github.com/robby031/axhash/blob/main/crates/axhash-core/src/hasher/core.rs): `crates/axhash-core/src/hasher/core.rs`
- [Hasher interface](https://github.com/robby031/axhash/blob/main/crates/axhash-core/src/hasher/trait_impl.rs): `crates/axhash-core/src/hasher/trait_impl.rs`
- [Backend dispatch](https://github.com/robby031/axhash/blob/main/crates/axhash-core/src/backend/mod.rs): `crates/axhash-core/src/backend/mod.rs`
- [Scalar backend](https://github.com/robby031/axhash/blob/main/crates/axhash-core/src/backend/scalar.rs): `crates/axhash-core/src/backend/scalar.rs`
- [AVX2 backend](https://github.com/robby031/axhash/blob/main/crates/axhash-core/src/backend/x86_64.rs): `crates/axhash-core/src/backend/x86_64.rs`
- [NEON backend](https://github.com/robby031/axhash/blob/main/crates/axhash-core/src/backend/aarch64.rs): `crates/axhash-core/src/backend/aarch64.rs`
- [Hash arithmetic](https://github.com/robby031/axhash/blob/main/crates/axhash-core/src/math.rs): `crates/axhash-core/src/math.rs`
- [Memory loads](https://github.com/robby031/axhash/blob/main/crates/axhash-core/src/memory.rs): `crates/axhash-core/src/memory.rs`
- [Hash constants](https://github.com/robby031/axhash/blob/main/crates/axhash-core/src/constants.rs): `crates/axhash-core/src/constants.rs`

### Native interface

- [C ABI](https://github.com/robby031/axhash/blob/main/crates/axhash-ffi/src/lib.rs): `crates/axhash-ffi/src/lib.rs`

### Other components

- **Rust caller**
- **C caller**

## Connections

- Rust caller → Crate facade: uses (evidence: `README.md`)
- Crate facade → Hash API: re-exports (evidence: `README.md`)
- Hash API → Backend dispatch: dispatches (evidence: `crates/axhash-core/src/hasher/api.rs`)
- Hash API → Hash arithmetic: uses (evidence: `crates/axhash-core/src/hasher/api.rs`)
- BuildHasher → Hash arithmetic: uses (evidence: `crates/axhash-core/src/hasher/build.rs`)
- Hasher state → Hash arithmetic: uses (evidence: `crates/axhash-core/src/hasher/core.rs`)
- Hasher interface → Hasher state: implements (evidence: `crates/axhash-core/src/hasher/trait_impl.rs`)
- Hasher interface → Backend dispatch: dispatches (evidence: `crates/axhash-core/src/hasher/trait_impl.rs`)
- Hasher interface → Hash arithmetic: uses (evidence: `crates/axhash-core/src/hasher/trait_impl.rs`)
- Backend dispatch → Scalar backend: dispatches (evidence: `crates/axhash-core/src/backend/mod.rs`)
- Backend dispatch → AVX2 backend: dispatches (evidence: `crates/axhash-core/src/backend/mod.rs`)
- Backend dispatch → NEON backend: dispatches (evidence: `crates/axhash-core/src/backend/mod.rs`)
- Scalar backend → Hash arithmetic: uses (evidence: `crates/axhash-core/src/backend/scalar.rs`)
- Scalar backend → Memory loads: loads via (evidence: `crates/axhash-core/src/backend/scalar.rs`)
- Scalar backend → Hash constants: uses (evidence: `crates/axhash-core/src/backend/scalar.rs`)
- AVX2 backend → Scalar backend: shares helpers (evidence: `crates/axhash-core/src/backend/x86_64.rs`)
- AVX2 backend → Hash constants: uses (evidence: `crates/axhash-core/src/backend/x86_64.rs`)
- NEON backend → Scalar backend: shares helpers (evidence: `crates/axhash-core/src/backend/aarch64.rs`)
- NEON backend → Memory loads: loads via (evidence: `crates/axhash-core/src/backend/aarch64.rs`)
- NEON backend → Hash constants: uses (evidence: `crates/axhash-core/src/backend/aarch64.rs`)
- Hash arithmetic → Hash constants: uses (evidence: `crates/axhash-core/src/math.rs`)
- C caller → C ABI: calls (evidence: `README.md`)
- C ABI → Hash API: uses core
