in reply to Re^4: [OT] The statistics of hashing.

in thread [OT] The statistics of hashing.

If I get a chance I'll try to work out the probability of "having seen a dup" in the first 1e9 iterations.

Thank you if you do find that time at some point. If you could also *show your workings*, I might be able to wrap my muddled brain around it and stand a chance of re-applying your derivation.

it probably has little bearing on this actual case where we're looking at MD5 hashes instead of random selections.

Whilst the MD5 hash is known to be imperfect, it has been well analysed and has been demonstrated to produce a close to perfect random distribution of bits from the input data by several practical measures.

Eg. If you take any single input text, and produce its MD5; and then vary a single bit in the input and produce a new MD5, then -- on average -- half of the bits in the new MD5 will have changed relative to the original.

And if you repeat that process -- varying a single bit in the input and then compare the original and new MD5s -- the average number of bits changed in the outputs will tend towards 1/2. That is about as good a measure of randomness as you can hope for from a deterministic process.

I am aware of the limitations on the distribution of the hashes when derived from a non-full spectrum of inputs; but given that 2**32 (the maximum capacity of the vectors), represent such a minuscule proportion of the 1e44 possible inputs, I'd have to be extremely unlucky in my random selection from the total inputs for the hashing bias to actually have a measurable affect upon the probabilities of false positives.