-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* more things * mm128 returns bytes * restructure * lint * allow seeding all new funcs * cleanup * swap hashing crates * restructure
- Loading branch information
1 parent
fb1b24e
commit e71b15e
Showing
8 changed files
with
297 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
use mur3::murmurhash3_x64_128; | ||
use mur3::murmurhash3_x86_32; | ||
pub fn murmurhash3_32(value: Option<&str>, seed: u32) -> Option<u32> { | ||
value.map(|v| murmurhash3_x86_32(v.as_bytes(), seed)) | ||
} | ||
|
||
pub fn murmurhash3_128(value: Option<&str>, seed: u32) -> Option<Vec<u8>> { | ||
value.map(|v| { | ||
let mut result = Vec::new(); | ||
let hash = murmurhash3_x64_128(v.as_bytes(), seed); | ||
|
||
result.extend_from_slice(hash.0.to_le_bytes().as_ref()); | ||
result.extend_from_slice(hash.1.to_le_bytes().as_ref()); | ||
|
||
result | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
use xxhash_rust::xxh32::xxh32; | ||
use xxhash_rust::xxh64::xxh64; | ||
|
||
pub fn xxhash_32(value: Option<&str>, seed: u32) -> Option<u32> { | ||
value.map(|v| xxh32(v.as_bytes(), seed)) | ||
} | ||
|
||
pub fn xxhash_64(value: Option<&str>, seed: u64) -> Option<u64> { | ||
value.map(|v| xxh64(v.as_bytes(), seed)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters