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

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s