Improve the OOP ABI
Siarhei Siamashka
siarhei.siamashka at gmail.com
Tue Jan 23 22:15:11 UTC 2024
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
>>
>> https://xxhash.com/
>
> 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:
> As an example, if a 64-bit hash is used, there are
> approximately 1.8×10^^19 different outputs. If these are all
> equally probable (the best case), then it would take 'only'
> approximately 5 billion attempts (5.38×10^^9) to generate a
> collision using brute force.[6] This value is called birthday
> bound[7] and for n-bit codes it could be approximated as
> 2^^(n/2).
I would say that any 64-bit hash is not sufficiently collision
resistant for the problem that you are trying to solve.
More information about the Digitalmars-d
mailing list