Here you can find the source of MD5Encoding(String source)
public static String MD5Encoding(String source) throws NoSuchAlgorithmException
//package com.java2s; //License from project: LGPL import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; public class Main { public static String MD5Encoding(String source) throws NoSuchAlgorithmException { MessageDigest mdInst = MessageDigest.getInstance("MD5"); byte[] input = source.getBytes(); mdInst.update(input);/*from w w w. jav a 2s . c o m*/ byte[] output = mdInst.digest(); int i = 0; StringBuffer buf = new StringBuffer(""); for (int offset = 0; offset < output.length; offset++) { i = output[offset]; if (i < 0) { i += 256; } if (i < 16) { buf.append("0"); } buf.append(Integer.toHexString(i)); } return buf.toString(); } }