How to check valid SHA1 and MD5 in Java


SHA1 key has 40 hexadecimal

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

MD5 key has 32 hexadecimal

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


me on google plus+Jirawong Wongdokpuang

Advertisements