Can an MD5-hash begin with a zero?

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

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

8条回答
  •  暗喜
    暗喜 (楼主)
    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
    

提交回复
热议问题