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

前端 未结 5 595
陌清茗
陌清茗 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 01:10

    MD5 verifier:

    public boolean isValidMD5(String s) {
    return s.matches("[a-fA-F0-9]{32}");}
    

    And remove "-" of the string value.

提交回复
热议问题