Can an MD5-hash begin with a zero?

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

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

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

    MD5 hash of "a" = 0cc175b9c0f1b6a831c399e269772661

    SHA1 hash of "9" = 0ade7c2cf97f75d009975f4d720d1fa6c19f4897

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

    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
    
    0 讨论(0)
提交回复
热议问题