On Wednesday, 24 January 2024 at 01:18:18 UTC, deadalnix wrote:
>On Tuesday, 23 January 2024 at 22:15:11 UTC, Siarhei Siamashka wrote:
>On Tuesday, 23 January 2024 at 21:37:42 UTC, Walter Bright wrote:
>On 1/23/2024 3:49 AM, Andrea Fontana wrote:
>So probably you like xxhash128
Thanks! I do, it has a 64 bit version, does anyone know what the collision rate is?
If you really need a 64-bit version, then you can simply take the first 64 bits of MD5. Assuming no defects in a 64-bit hash implementation, the collision probability is 1.0 / 2^^64
for a pair of hashed strings. And it becomes a https://en.wikipedia.org/wiki/Birthday_problem if the number of hashed strings is larger. There's no magic algorithmic sauce that can make a small hash collision resistant. A quote from the Wikipedia article:
While it is not possible to do better than this, it is certainly possible - and in fact way easier than you'd expect - to do worse.
Go ahead and show me truncated output of any hash, designed to be cryptographically secure, behaving badly. I know that xxhash, ahash, fnv or any other non-secure hashes are prone to have collision issues, as they are primarily optimized for speed while being borderline acceptable from the collision standpoint.