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.
Asked
Active
Viewed 175 times
4
-
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. – Maarten Bodewes Nov 13 '15 at 18:27
1 Answers
5
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.

Reid Rankin
- 642
- 3
- 11
-
1Because 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. – Maarten Bodewes Nov 13 '15 at 18:26
-
-
-
3@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. – otus Nov 14 '15 at 22:11
-
@otus True enough, I stand corrected. My estimate is off by $2^{-384}$. Sheesh, crypto is a tough place ;) – Maarten Bodewes Nov 14 '15 at 23:24