public class MD5Util { public static String getDigestedPassword(String password) throws NoSuchAlgorithmException { byte[] buf = password.getBytes(); MessageDigest md5 = MessageDigest.getInstance("MD5"); md5.update(buf); byte[] tmp = md5.digest(); StringBuilder sb = new StringBuilder(); for (byte b : tmp) { sb.append(Integer.toHexString(b & 0xff)); } return sb.toString(); } }