Here you can find the source of MD5(String s)
public final static String MD5(String s)
//package com.java2s; import java.security.MessageDigest; public class Main { public final static String MD5(String s) { try {/*from w w w.ja v a2 s.c o m*/ byte[] btInput = s.getBytes(); MessageDigest mdInst = MessageDigest.getInstance("MD5"); mdInst.update(btInput); byte[] md = mdInst.digest(); StringBuilder sBuilder = bytesToHexString(md); return sBuilder.toString(); } catch (Exception e) { e.printStackTrace(); return null; } } public static StringBuilder bytesToHexString(byte[] bytesArray) { if (bytesArray == null) { return null; } StringBuilder sBuilder = new StringBuilder(); for (byte b : bytesArray) { String hv = String.format("%02x", b); sBuilder.append(hv); } return sBuilder; } }