Crate twox_hash[][src]

A Rust implementation of the XXHash algorithm.

With a fixed seed

use std::hash::BuildHasherDefault;
use std::collections::HashMap;
use twox_hash::XxHash64;

let mut hash: HashMap<_, _, BuildHasherDefault<XxHash64>> = Default::default();
hash.insert(42, "the answer");
assert_eq!(hash.get(&42), Some(&"the answer"));

With a random seed

use std::collections::HashMap;
use twox_hash::RandomXxHashBuilder64;

let mut hash: HashMap<_, _, RandomXxHashBuilder64> = Default::default();
hash.insert(42, "the answer");
assert_eq!(hash.get(&42), Some(&"the answer"));

Re-exports

pub use crate::xxh3::Hash128 as Xxh3Hash128;
pub use crate::xxh3::Hash64 as Xxh3Hash64;

Modules

xxh3

The in-progress XXH3 algorithm.

Structs

RandomXxHashBuilder32

Constructs a randomized seed and reuses it for multiple hasher instances. See the usage warning on XxHash32.

RandomXxHashBuilder64

Constructs a randomized seed and reuses it for multiple hasher instances.

RandomXxh3HashBuilder64

Constructs a randomized seed and reuses it for multiple hasher instances.

RandomXxh3HashBuilder128

Constructs a randomized seed and reuses it for multiple hasher instances.

XxHash32

Calculates the 32-bit hash. Care should be taken when using this hash.

XxHash64

Calculates the 64-bit hash.

Type Definitions

RandomXxHashBuilder

A backwards compatibility type alias. Consider directly using RandomXxHashBuilder64 instead.

XxHash

A backwards compatibility type alias. Consider directly using XxHash64 instead.