jumpch

Crates.iojumpch
lib.rsjumpch
version1.0.0
sourcesrc
created_at2022-07-04 16:51:29.403312
updated_at2022-07-04 16:51:29.403312
descriptionJump Consistent Hashing is a fast, minimal memory, consistent hash algorithm.
homepage
repositoryhttps://github.com/Mnwa/jumpch
max_upload_size
id619047
size18,375
Mikhail Panfilov (Mnwa)

documentation

https://docs.rs/jumpch

README

Jump Consistent Hash algorithm

Jump Consistent Hashing is a fast, minimal memory, consistent hash algorithm. In comparison to the algorithm of Karger et al., jump consistent hash requires no storage, is faster, and does a better job of evenly dividing the key space among the buckets and of evenly dividing the workload when the number of buckets changes.

Usage

use std::collections::hash_map::DefaultHasher;
use std::hash::{Hash, Hasher};
use jumpch::JumpHasher;

fn main () {
    let mut hasher: JumpHasher<DefaultHasher> = JumpHasher::new(1000);

    "test".hash(&mut hasher);

    assert_eq!(hasher.finish(), 677)
}
use jumpch::hash;

fn main () {
    assert_eq!(hash(123456, 1000), 176)
}

Contributing

Any PR's and issues are welcome.

License

This lib is distributed by MIT and Apache 2.0 licenses. Just choose what's you want.

Commit count: 9

cargo fmt