Are there any hash outputs not produced by the MD5 hash function? I need to use it as a placeholder for an empty hash while comparing two hashes.
-
$\begingroup$ Beware of magic values in general. If possible, design your programs in such a way that you don't need placeholders. If you use it you could also use the ASCII encoding of "this=placeholder", it's equally unlikely to generate that value as all zero's. $\endgroup$– Maarten Bodewes ♦Nov 13, 2015 at 18:27
1 Answer
Not provably. Maybe, since it's not a permutation, but you couldn't verify it practically.
Just use all-zeroes: it's easily recognizable as a null value, and thanks to pre-image resistance, no-one knows what hashes to that.
-
1$\begingroup$ Because of the infinite input possibilities and since the structure is not likely to exclude values, I'd say that the chance that all outputs cannot be produced is extremely unlikely. It's likewise extremely unlikely that you'd ever generate a hash containing of all zero's by chance, even if it is rather certain that it exists. $\endgroup$– Maarten Bodewes ♦Nov 13, 2015 at 18:26
-
-
-
3$\begingroup$ @MaartenBodewes, since the possible outputs are really a property of the compression function, there are not nearly infinite inputs. The compression function takes 640 bits of input and produces 128 bits of output so for a random function of that size the probability of some output missing is about $2^{-384}$ if my mental math works. $\endgroup$– otusNov 14, 2015 at 22:11
-
$\begingroup$ @otus True enough, I stand corrected. My estimate is off by $2^{-384}$. Sheesh, crypto is a tough place ;) $\endgroup$– Maarten Bodewes ♦Nov 14, 2015 at 23:24