polymur-hash 0.2.2

Polymur hash function
Documentation
# CLAUDE.md

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

## Commands

### Build
```bash
cargo build
cargo build --release
```

### Test
```bash
cargo test
cargo test -- --nocapture  # Show test output
```

### Benchmarks
```bash
cargo bench
```

### Check code compilation
```bash
cargo check
```

## Architecture

This is a Rust implementation of the PolymurHash universal hash function. The library is `no_std` compatible and provides a fast, non-cryptographic hash function.

### Core Components

1. **`PolymurHash` struct** (src/lib.rs): The main hasher implementation containing precomputed values (k, k2, k7, s) derived from the seed. Implements `Clone` and `Debug`.

2. **`PolymurHasher` struct** (src/lib.rs): Implements `core::hash::Hasher` trait for integration with Rust's standard collections like HashMap and HashSet. Works in no_std environments (requires `alloc`).

3. **Seeding**: Three ways to initialize:
   - `new(seed: u128)`: From 128-bit seed
   - `from_u64_seed(seed: u64)`: From 64-bit seed  
   - `from_u64x2_seed(k_seed: u64, s_seed: u64)`: From two 64-bit seeds

4. **Hashing Methods**:
   - `hash(&self, buf: impl AsRef<[u8]>) -> u64`: Standard hash function
   - `hash_with_tweak(&self, buf: impl AsRef<[u8]>, tweak: u64) -> u64`: Hash with additional tweak parameter

5. **Implementation Details**:
   - Uses polynomial evaluation in GF(2^61-1) field
   - Optimized for different input sizes (<=7 bytes, 8-49 bytes, >=50 bytes)
   - No unsafe code (`#![forbid(unsafe_code)]`)
   - All performance-critical functions are marked `#[inline(always)]`

### Examples

- `examples/basic.rs`: Basic usage demonstrating hashing and seed variants
- `examples/hashmap.rs`: Using PolymurHasher with HashMap
- `examples/tweaks.rs`: Advanced usage with tweaks for bloom filters

### Benchmarking

The `benches/benchmark.rs` file compares PolymurHash performance against other popular hash functions (FNV, FxHash, XXH3, Komihash) across various input sizes from 1 byte to 64KB.