NIF bindings for XXH3 hash functions implemented in Rust
XXH3 is a new speed-optimized hash algorithm of the xxHash family of non-cryptographic hash functions, featuring:Speed analysis methodology is explained here:
https://fastcompression.blogspot.com/2019/03/presenting-xxh3.htmlabstract datatype: xxh3_ref()
digest/1 | Computes hash for streamed data. |
hash128/1 | Returns 128-bit hash for the given Data . |
hash128/2 | Returns 128-bit hash for the given Data with Seed value. |
hash128_with_secret/2 | Returns 128-bit hash for the given Data with a custom Secret . |
hash64/1 | Returns 64-bit hash for the given Data . |
hash64/2 | Returns 64-bit hash for the given Data with Seed value. |
hash64_with_secret/2 | Returns 64-bit hash for the given Data with a custom Secret . |
new/0 | Creates a new 64-bit hasher with default secret. |
new/1 | Creates a new 64-bit hasher with the given Seed . |
new_with_secret/1 | Creates a new 64-bit hasher with the given Secret . |
reset/1 | Resets hasher state. |
update/2 | Updates hasher state with the given chunk of data. |
digest(Resource::xxh3_ref()) -> non_neg_integer()
Computes hash for streamed data.
hash128(Data::binary()) -> non_neg_integer()
Returns 128-bit hash for the given Data
.
hash128(Data::binary(), Seed::non_neg_integer()) -> non_neg_integer()
Returns 128-bit hash for the given Data
with Seed
value.
hash64/2
for more details.
hash128_with_secret(Data::binary(), Secret::binary()) -> non_neg_integer()
Returns 128-bit hash for the given Data
with a custom Secret
.
hash64_with_secret/2
for more details.
hash64(Data::binary()) -> non_neg_integer()
Returns 64-bit hash for the given Data
.
hash64(Data::binary(), Seed::non_neg_integer()) -> non_neg_integer()
Returns 64-bit hash for the given Data
with Seed
value.
Seed
value.
While this operation is decently fast, note that it's not completely free.
hash64_with_secret(Data::binary(), Secret::binary()) -> non_neg_integer()
Returns 64-bit hash for the given Data
with a custom Secret
.
Secret
size *must* be large enough (>= 136 bytes).
However, the quality of produced hash values depends on secret's entropy.
Technically, the secret must look like a bunch of random bytes.
Avoid "trivial" or structured data such as repeated sequences or a text document.
new() -> xxh3_ref()
Creates a new 64-bit hasher with default secret.
You can stream data to the returned object usingupdate/2
,
and calculate intermediate hash values using digest/1
.
new(Seed::non_neg_integer()) -> xxh3_ref()
Creates a new 64-bit hasher with the given Seed
.
new_with_secret(Secret::binary()) -> xxh3_ref()
Creates a new 64-bit hasher with the given Secret
.
Secret
must be a binary of size 192 bytes.
reset(Resource::xxh3_ref()) -> ok
Resets hasher state.
update(Resource::xxh3_ref(), Data::binary()) -> ok
Updates hasher state with the given chunk of data.
Generated by EDoc