# Usage Guide
Complete guide for using AxHash in Rust and other languages.
## Pick The Right Package
| Rust application | `axhash` |
| C / C++ / Go / Zig / Swift / Kotlin Native | `axhash-ffi` |
| `no_std` / embedded / low-level engine | `axhash-core` |
## Rust Quick Start
Add the dependency:
```toml
[dependencies]
axhash = "1.0"
```
> **Upgrading from 0.x?** Hash output values change for inputs longer than
> 128 bytes (the long-input algorithm was redesigned so the same input
> produces the same hash on every CPU). See [CHANGELOG.md](../CHANGELOG.md)
> for the full migration note. Inputs ≤ 128 bytes are unaffected. The
> hashing API itself (`hash`, `hash_with_seed`, `hash_value`, `AxHasher`,
> `AxBuildHasher`) is source-compatible — only the runtime-backend
> introspection helpers were renamed.
### Hash raw bytes
```rust
use axhash::hash;
fn main() {
let digest = hash(b"hello axhash");
println!("{digest:016x}");
}
```
### Hash raw bytes with a seed
```rust
use axhash::hash_with_seed;
fn main() {
let digest = hash_with_seed(b"hello axhash", 0x1234_5678);
println!("{digest:016x}");
}
```
### Hash any Rust value that implements `Hash`
```rust
use axhash::hash_value;
#[derive(Hash)]
struct SessionKey {
account_id: u64,
region_id: u32,
flags: u32,
}
fn main() {
let key = SessionKey {
account_id: 42,
region_id: 7,
flags: 3,
};
let digest = hash_value(&key);
println!("{digest:016x}");
}
```
### Use the streaming hasher
```rust
use axhash::AxHasher;
use std::hash::Hasher as _;
fn main() {
let mut hasher = AxHasher::new_with_seed(0x4444);
hasher.write(b"hello ");
hasher.write(b"world");
println!("{:016x}", hasher.finish());
}
```
### Use AxHash with `HashMap`
```rust
use axhash::AxBuildHasher;
use std::collections::HashMap;
fn main() {
let mut map =
HashMap::with_hasher(AxBuildHasher::with_seed(0xfeed_beef));
map.insert("status", "ok");
map.insert("runtime", "fast");
println!("{:?}", map.get("status"));
}
```
### Inspect the active backend
```rust
use axhash::{runtime_backend, runtime_has_simd};
fn main() {
println!("{:?}", runtime_backend());
println!("{}", runtime_has_simd());
}
```
All backends — `Scalar`, `Aarch64Neon`, `X86_64Avx2` — produce **bit-identical
hash output** for the same input and seed. The runtime selection only affects
throughput on long inputs; values can be persisted or compared across machines
regardless of which backend ran.