How do I check if a string is a valid md5 or sha1 checksum string

前端 未结 5 491
陌清茗
陌清茗 2020-12-30 00:10

I don\'t want to calculate a file\'s checksum, just to know if a given string is a valid checksum

5条回答
  •  生来不讨喜
    2020-12-30 00:49

    Any 160-bit sequence is a possible SHA1 hash. Any 128-bit sequence is a possible MD5 hash.

    If you're looking at the hex string representations of them, then a sha1 will look like 40 hexadecimal digits, and an md5 will look like 32 hexadecimal digits.

提交回复
热议问题