JenkHash 0.2.1

Bob Jenkins hash functions for Rust with a digest-compatible API.
Documentation
  • Coverage
  • 100%
    19 out of 19 items documented11 out of 14 items with examples
  • Size
  • Source code size: 81.72 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 3.43 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 12s Average build duration of successful builds.
  • all releases: 15s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Repository
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • DrakeTDL

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