public static String md5(String s) {
        try {
            MessageDigest md5 = MessageDigest.getInstance("MD5");
            byte[] digest = md5.digest(s.getBytes(Charset.forName("UTF-8")));
            StringBuilder buf = new StringBuilder(2 * digest.length);
            for (byte oneByte : digest) {
                buf.append(Integer.toHexString((oneByte & 0xFF) | 0x100).substring(1, 3));
            }
            return buf.toString();
        } catch (NoSuchAlgorithmException ignore) { }
        return s;
    }
public static String md5 ( String s ) { try { MessageDigest md5 = MessageDigest . getInstance ( "MD5" ) ; byte [ ] digest = md5 . digest ( s . getBytes ( Charset . forName ( "UTF-8" ) ) ) ; StringBuilder buf = new StringBuilder ( 2 * digest . length ) ; for ( byte oneByte : digest ) { buf . append ( Integer . toHexString ( ( oneByte & 0xFF ) | 0x100 ) . substring ( 1 , 3 ) ) ; } return buf . toString ( ) ; } catch ( NoSuchAlgorithmException ignore ) { } return s ; }
Computes a MD5 fingerprint of a text-string and returns as a HEX encoded string.
@param s     string to process
@return HEX encoded MD5 fingerprint