php - Where can I find xxhash64 and md5 collision probability statistics? -
i dont find info % of collisions xxhash64.
i'm going use cache system (to generate hash keys need unique, hundreds millions). use md5, don't need cryptographic property.
so need info, decide decision task. in best case - comparison of number of collisions between md5 , xxhash64.
you can calculate using birthday problem.
in general mathematical expression gives probability of hash function :
p(k) = 1 - exp(-k(k-1)/2n, k (number of hashes) randomly generated values, each value non-negative integer less n (number of possible hashes):n = 2^(number of bit), example md5 2^128, or 2^32 32 bit-hash
if use md5
will produce 128-bit hash value, applying formula 's' graph. graph explains, example, in order collison probability of 50% (0.5), need @ least 2100000 trillion of hashes!!!! if use less than, instance 1 billion of hashes, probability of collision negligible.
if using hundred millions of hashed keys, probability of collision 0% using md5.
if use xxhash64,
assuming xxhash64 produce 64-bit hash. graph.
according picture, can see if collision percentage 50%, need @ least 5 billion of hashes. 2 of 5 billion of hashes can have odd of 1/2 have same hashes!!! if have around 12 billion of hashes there 100% of chance hashes collide.
if using hundred millions of hashed keys, probability of collision 0,033% using xxhash64.
this link explains why md5 or fast hash method not secure.
Comments
Post a Comment