hrw 0.1.2

A simple, generic implementation of Highest Random Weight (HRW or Rendezvous) hashing
Documentation
  • Coverage
  • 45.45%
    5 out of 11 items documented1 out of 11 items with examples
  • Size
  • Source code size: 13.9 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.57 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: 12s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • sweet-security/hrw
    1 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • tomerfiliba

hrw

A simple, generic implementation of Highest Random Weight (HRW or Rendezvous) hashing in Rust.

Features

  • Deterministic node selection for any key
  • Pluggable hashers (e.g., ahash, std)
  • Add/remove nodes at runtime
  • No external dependencies for core logic

Example

use hrw::Rendezvous;

let mut r = Rendezvous::from_nodes(["A", "B"]);
assert_eq!(r.len(), 2);
r.add_node("C");
assert_eq!(r.len(), 3);
r.remove_node(&"B");
assert_eq!(r.len(), 2);
let chosen = r.pick_top(&"my-key");
assert!(chosen.is_some());

License

MIT