feat: add xxhash64#39
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds an xxhash64 implementation to the hash module, matching the DataSketches Java behavior. The implementation provides a fast, non-cryptographic 64-bit hash function with seeded hashing support.
- Implements
XxHash64struct with the standardHashertrait - Provides both streaming API (
write/finish64) and convenience method (hash_u64) - Includes comprehensive test coverage with reference test vectors for verification
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| src/hash/xxhash.rs | New complete implementation of xxhash64 with constants, hasher struct, trait implementations, helper functions, and test suite |
| src/hash/mod.rs | Adds module declaration and public export for XxHash64 (with unused_imports attribute as hash module is currently internal-only) |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
I think we should wait for sketches that need xxhash before shipping it ourselves. cc @tisonkun |
Agree. We can hold this PR for now. Whether or not publish the hash function is still under discussion, somehow datasketches-java and dataskecthes-cpp use them internally and datasketches-go clearly define the hash function internally. Seems mainly BloomFilter uses XxHash. @PsiACE you can take a look at #5 to see where we can have those sketches and xxhash as part of its implementation. |
|
I am working on a implementation of bloom filters at the moment. I can rework it to use this PR. |
Great! When it is desired, you can use |
Signed-off-by: Chojan Shang <[email protected]>
|
twox-hash has some But first we should use our own impl in some concrete sketches to see the requirement and input pattern. |
I just found that we've implemented murmur3hash ourselves, while Java also implements xxhash.