Uniquely identifying URLs with one 64-bit number

前端 未结 5 1058
无人共我
无人共我 2021-02-09 05:12

This is basically a math problem, but very programing related: if I have 1 billion strings containing URLs, and I take the first 64 bits of the MD5 hash of each of them, what ki

5条回答
  •  悲哀的现实
    2021-02-09 05:28

    You have tagged this as "birthday-paradox", I think you know the answer already.

    P(Collision) = 1 - (2^64)!/((2^64)^n (1 - n)!)
    

    where n is 1 billion in your case.

    You will be a bit better using something other then MD5, because MD5 have pratical collusion problem.

提交回复
热议问题