-
Notifications
You must be signed in to change notification settings - Fork 778
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Clarify in documentation if zero can be returned #887
Comments
Hi @mikesreed , thank you for your opion. In short, xxHash may return // example-xxh64-returns-0.c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
#define XXH_STATIC_LINKING_ONLY
#define XXH_IMPLEMENTATION /* access definitions */
#include "xxhash.h"
int main()
{
uint64_t const seed = (uint64_t) (0ULL - XXH_PRIME64_5);
XXH64_hash_t const hash = XXH64(NULL, 0, seed);
// Converts hash value to canonical representation
XXH64_canonical_t c;
XXH64_canonicalFromHash(&c, hash);
// Display the content of canonical representation
printf("hash = 0x");
for (size_t i = 0; i < sizeof(c.digest); ++i) {
printf("%02x", c.digest[i]);
}
printf("\n");
return EXIT_SUCCESS;
} @easyaspi314 's nice sketch will help you to understand this code. |
The The situation is the same for The main difference between That's the difference between "accidental" and "intentional" collisions. However, if producing a value |
Hi,
I'm currently using SHA1 for a hash in a program but was considering xxHash instead. However, my code relies on the fact (belief?) that SHA1 can not create a hash of all zero bits. I've gone through the xxHash documentation but can't find any mention of this. I'm specifically interested in the XXH64 and XXH3_64 algorithms. But it would be nice to state clearly for all the different algos whether they can ever return zero or not.
Thanks for your time.
Regards,
Mike.
The text was updated successfully, but these errors were encountered: