DoumanAsh / xxhash-rust

Rust implementation of xxhash
Boost Software License 1.0
203 stars 20 forks source link

Derive Clone for Xxh32/64 #33

Closed nyurik closed 9 months ago

nyurik commented 9 months ago

In some obscure cases, like implementing Digest traits for non-cryptographical hashes, I could really use the Clone implementation to keep things simpler.

See https://github.com/nyurik/noncrypto-digests

DoumanAsh commented 9 months ago

I'm not really sure what is benefit of having Clone? Do you want to copy instance instead of creating new one every time?

Normally you want to create new instance rather than cloning existing one (you need to reset state)

But I do not mind adding Clone in any way so it is fine

nyurik commented 9 months ago

@DoumanAsh the Digest trait seem to require it, I would like to offer the same Digest trait access to all hash functions, not just the MD5/SHA256/... as part of the noncrypto-digests crate (fnv and xxh3 are implemented already). This way my sqlite-hashes crate can transparently offer all hash functions, both cryptographic and not, without knowing the specifics of any hash implementation. Moreover, I suspect others may want to have this polymorphic approach to hashes.

DoumanAsh commented 9 months ago

yeah it is fine it is anyway up to user to user Clone correctly I will merge it, but I will see to release a bit later if you need it

nyurik commented 9 months ago

thx, let me know when you release (no rush), so i will add it to my crate. thx for such great response time!

DoumanAsh commented 9 months ago

I released 0.8.8