diff --git a/crates/ltk_hash/Cargo.toml b/crates/ltk_hash/Cargo.toml index 70a9e0be..0125cd80 100644 --- a/crates/ltk_hash/Cargo.toml +++ b/crates/ltk_hash/Cargo.toml @@ -7,3 +7,4 @@ license = "MIT OR Apache-2.0" readme = "../../README.md" [dependencies] +xxhash-rust = { workspace = true } diff --git a/crates/ltk_hash/src/lib.rs b/crates/ltk_hash/src/lib.rs index bbb2f0e2..4b330549 100644 --- a/crates/ltk_hash/src/lib.rs +++ b/crates/ltk_hash/src/lib.rs @@ -1,3 +1,4 @@ //! Other utilities (hashing, etc) pub mod elf; pub mod fnv1a; +pub mod xxhash; diff --git a/crates/ltk_hash/src/xxhash.rs b/crates/ltk_hash/src/xxhash.rs new file mode 100644 index 00000000..b0b1e36c --- /dev/null +++ b/crates/ltk_hash/src/xxhash.rs @@ -0,0 +1,10 @@ +use xxhash_rust::xxh64::xxh64; + +/// Computes the XXHash64 of `input` bytes with the given `seed`. +/// +/// This is a thin wrapper around [`xxhash_rust::xxh64::xxh64`] that is +/// re-exported so downstream crates can depend on a single hashing crate. +#[inline] +pub fn xxhash64(input: &[u8], seed: u64) -> u64 { + xxh64(input, seed) +}