Can an MD5-hash begin with a zero?

Rygu picture Rygu · Jul 5, 2010 · Viewed 10.6k times · Source

Can an MD5-hash begin with a zero? What about SHA-1?

Answer

Joey Adams picture Joey Adams · Jul 5, 2010

Yes:

$ echo -n "363" | md5sum
00411460f7c92d2124a67ea0f4cb5f85  -
$ echo -n "351" | sha1sum
0026476a20bfbd08714155bb66f0b4feb2d25c1c

Found by running the following in bash:

for i in  {1..1000} ; do echo $(echo -n $i | md5sum) $i ; done | sort | head