Packages / rupm

rs-hash-xxhash 0.1.0

XXH32 and XXH64 non-cryptographic hashes with seeds and a streaming API, std only

Install

cargo add rs-hash-xxhash --registry rupm

In Ruststudio: Packages, search for rs-hash-xxhash, Install.

Owner: Rust Studio. Licence: MIT OR Apache-2.0. Total downloads: 0. Published 2026-11-23.

Versions

README

# rs-hash-xxhash

XXH32 and XXH64 non-cryptographic hashes with seeds and a streaming API, std only

Add it with `rupm add rs-hash-xxhash` (or `cargo add rs-hash-xxhash --registry rupm`).

The hashes are checked against the reference xxHash implementation's published values. xxHash is a fast checksum for hash tables, deduplication and integrity checks. It is not a cryptographic hash: never use it to authenticate data.

## Install

```
rupm add rs-hash-xxhash
```

## Usage

```rust
assert_eq!(rs_hash_xxhash::xxh32(b"abc", 0), 0x32d153ff);
assert_eq!(rs_hash_xxhash::xxh64(b"abc", 0), 0x44bc2cf5ad770999);

// Streaming gives the same answer as the one-shot call.
let mut h = rs_hash_xxhash::Xxh64::new(0);
h.update(b"a");
h.update(b"bc");
assert_eq!(h.digest(), 0x44bc2cf5ad770999);
```

## API overview

- `xxh32(data, seed)` returns `u32`, `xxh64(data, seed)` returns `u64`.
- `Xxh32`, `Xxh64`: streaming hashers with `new(seed)`, `update`, `digest` (non-consuming, so you can peek mid-stream) and `reset`.
- `xxh32_hex`, `xxh64_hex`: zero-padded lowercase hex of the one-shot hash.