JenkHash

Crates.ioJenkHash
lib.rsJenkHash
version0.3.0
created_at2025-12-19 07:22:39.267951+00
updated_at2025-12-23 09:08:01.42039+00
descriptionBob Jenkins hash functions for Rust with a digest-compatible API.
homepage
repositoryhttps://gitlab.com/DrakeTDL/JenkHash
max_upload_size
id1994340
size87,670
(DrakeTDL)

documentation

README

JenkHash

A collection of Bob Jenkins hash functions for Rust with a unified API. The crate targets no_std, provides a custom Hasher trait for incremental hashing, and ships reference implementations of several classic non-cryptographic hashes.

Available Hash Functions

  • OneAtATime — simple, fast 32-bit hash for hash tables
  • Lookup2 — original Jenkins hash (32-bit)
  • Lookup3 — improved Jenkins hash with stronger avalanche (32-bit)
  • Spooky — high-performance hash optimized for 64-bit CPUs (variable output sizes)

Installation

Add the crate to your Cargo.toml:

[dependencies]
jenkhash = "0.1"

Usage

use JenkHash::{Hasher, OneAtATime};

let mut hasher = OneAtATime::new();
hasher.write(b"hello");
hasher.write(b" world");
let hash = hasher.finalize();
assert_eq!(hash, 1045060183);

Notes

  • Use these hashes for non-cryptographic purposes (e.g., hash tables, sharding, deduplication).
  • Keep input sizes reasonable; these algorithms are not designed as secure cryptographic hashes.

Development

  • Tests: cargo test
  • Lint (Clippy): cargo clippy --all-targets --all-features
Commit count: 0

cargo fmt