Here you can find the source of md5(String password)
public static String md5(String password)
//package com.java2s; //License from project: LGPL import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import java.nio.charset.*; public class Main { public static String md5(String password) { byte[] uniqueKey = password.getBytes(Charset.forName("UTF-8")); byte[] hash = null; try {// ww w . j ava 2 s. c o m hash = MessageDigest.getInstance("MD5").digest(uniqueKey); } catch (NoSuchAlgorithmException e) { throw new Error("No MD5 support in this VM."); } StringBuilder hashString = new StringBuilder(); for (int i = 0; i < hash.length; i++) { String hex = Integer.toHexString(hash[i]); if (hex.length() == 1) { hashString.append('0'); hashString.append(hex.charAt(hex.length() - 1)); } else { hashString.append(hex.substring(hex.length() - 2)); } } return hashString.toString(); } }