Can an MD5-hash begin with a zero?

前端 未结 8 2927
鱼传尺愫
鱼传尺愫 2021-02-20 05:58

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

相关标签:
8条回答
  • 2021-02-20 06:11

    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.

    0 讨论(0)
  • 2021-02-20 06:11

    Try with the string : jk8ssl

    echo md5('jk8ssl')
    

    generate :

    00000000 18e6137a c2caab16 074784a6
    

    I didn't find better yet ^^

    0 讨论(0)
  • 2021-02-20 06:13

    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.

    0 讨论(0)
  • 2021-02-20 06:14

    md5 of a = 0cc175b9c0f1b6a831c399e269772661

    <?php echo md5( 'a' ); ?>
    

    Sha1 of i = 042dc4512fa3d391c5170cf3aa61e6a638f84342

    <?php echo sha1( 'i' ); ?>
    

    why not :D

    0 讨论(0)
  • 2021-02-20 06:16

    I found a MD5 hash that beginns with a zero byte!
    2 character String

    Unicode #7358 #34823

    $returnValue = md5('Ჾ蠇');
    

    result:

    00000000 5e0a51c8 313ffb43 8a3a2861
    
    0 讨论(0)
  • 2021-02-20 06:18

    In a cryptographic hash, any given bit should be equally likely to be a 0 or a 1 for random inputs.

    0 讨论(0)
提交回复
热议问题