Here you can find the source of md5String(String key)
public static String md5String(String key)
//package com.java2s; //License from project: Apache License import java.io.UnsupportedEncodingException; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; public class Main { public static String md5String(String key) { byte[] messageDigest = md5(key); return toHex(messageDigest); }/*from w w w .j a v a 2 s . com*/ public static byte[] md5(String key) { MessageDigest algorithm; try { algorithm = MessageDigest.getInstance("MD5"); } catch (NoSuchAlgorithmException ex) { throw new RuntimeException(ex); } algorithm.reset(); try { algorithm.update(key.getBytes("UTF-8")); } catch (UnsupportedEncodingException ex) { throw new RuntimeException(ex); } return algorithm.digest(); } public static String toHex(byte[] bytes) { StringBuilder hexString = new StringBuilder(); for (int i = 0; i < bytes.length; i++) { String hex = Integer.toHexString(0xFF & bytes[i]); if (hex.length() == 1) { hexString.append('0'); } hexString.append(hex); } return hexString.toString(); } }