Here you can find the source of MD5(String pData)
public static String MD5(String pData)
//package com.java2s; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; public class Main { public static String MD5(String pData) { MessageDigest md = null;//from w w w .j ava2 s .c o m try { md = MessageDigest.getInstance("MD5"); md.update(pData.getBytes()); } catch (NoSuchAlgorithmException e) { System.err.println("No such Algorithm!"); return null; } byte[] digest = md.digest(); StringBuffer lStr = new StringBuffer(); for (int i = 0; i < digest.length; i++) { String s = Integer.toHexString(digest[i] & 0xFF); if (s.length() == 1) lStr.append("0"); lStr.append(s); } return lStr.toString(); } }