sdk: Allow any byte stream for hashing dictionary entries
All checks were successful
lint/clippy Checking for common mistakes and opportunities for code improvement
build/linux Build for the target platform: linux
build/msvc Build for the target platform: msvc

This commit is contained in:
Lucas Schwiderski 2023-09-22 15:37:37 +02:00
parent c997489e18
commit f1f9a818cc
Signed by: lucas
GPG key ID: AA12679AAA6DF4D8

View file

@ -147,14 +147,14 @@ impl Dictionary {
Ok(())
}
pub fn add(&mut self, value: String, group: HashGroup) {
let long = Murmur64::from(murmurhash64::hash(value.as_bytes(), SEED as u64));
let short = Murmur32::from(murmurhash64::hash32(value.as_bytes(), SEED));
pub fn add(&mut self, value: impl AsRef<[u8]>, group: HashGroup) {
let long = Murmur64::from(murmurhash64::hash(value.as_ref(), SEED as u64));
let short = Murmur32::from(murmurhash64::hash32(value.as_ref(), SEED));
let entry = Entry {
long,
short,
value,
value: String::from_utf8_lossy(value.as_ref()).to_string(),
group,
};