Skip to main content

Module hashkit

Module hashkit 

Source
Expand description

Hashing primitives, token arithmetic, and ring distributions.

The HashType enum lists every hashing algorithm offered by the engine. hash dispatches a key to the chosen algorithm and yields a token::DynToken that can be compared and used as a key in a continuum.

§Examples

use dynomite::hashkit::{hash, HashType};

let token = hash(HashType::Murmur3, b"dynomite");
assert_eq!(token.len(), 4);

Re-exports§

pub use crate::hashkit::random_slicing::RandomSlices;
pub use crate::hashkit::random_slicing::RandomSlicesError;
pub use crate::hashkit::token::DynToken;

Modules§

ketama
Ketama consistent-hashing continuum.
modula
Modula distribution: each live server contributes a number of continuum slots equal to its weight, and dispatch is hash % ncontinuum.
random_slicing
Random-slicing distribution: a small, gap-free partition table over the 64-bit hash space.
token
Big-integer token used as the hash output and ring coordinate.

Structs§

PseudoRng
Linear congruential generator with the parameters used by glibc’s non-secure random() family. Sufficient for ring dispatch (the only caller); not cryptographically strong.

Enums§

HashType
All hashing algorithms supported by the engine.

Functions§

crc32_sz
CRC-32 over a buffer, lower-cased before mixing.
hash
Hash key with the requested algorithm and return the resulting token.
hash64
Hash key and return a 64-bit value used by the random-slicing distribution table.
md5_signature
Compute the raw 128-byte MD5 digest of key.
murmur3_x64_64
MurmurHash3 truncated to 64 bits.