Can an MD5-hash begin with a zero? What about SHA-1?
Of course. Or two zeros. Or more. In general, the probability of a "random" input hashing to a result with k leading zero nybbles is about 2-4k.
Try with the string : jk8ssl
echo md5('jk8ssl')
generate :
00000000 18e6137a c2caab16 074784a6
I didn't find better yet ^^
This thread is pretty old now, but there are some very high & very low value hashes for SHA1 and MD5 here:
https://web.archive.org/web/20171201071711/http://www.crysys.hu/hashgame/allrecord.php
One of those has 7 bytes of leading zeros.
md5 of a = 0cc175b9c0f1b6a831c399e269772661
<?php echo md5( 'a' ); ?>
Sha1 of i = 042dc4512fa3d391c5170cf3aa61e6a638f84342
<?php echo sha1( 'i' ); ?>
why not :D
I found a MD5 hash that beginns with a zero byte!
2 character String
Unicode #7358 #34823
$returnValue = md5('Ჾ蠇');
result:
00000000 5e0a51c8 313ffb43 8a3a2861
In a cryptographic hash, any given bit should be equally likely to be a 0 or a 1 for random inputs.