Here you can find the source of md5Hash(String in)
public static String md5Hash(String in)
//package com.java2s; //License from project: Apache License import java.io.UnsupportedEncodingException; import java.math.BigInteger; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; public class Main { public static String md5Hash(String in) { byte[] bytesOfMessage = null; try {//from w ww . j av a 2s. c o m bytesOfMessage = in.getBytes("UTF-8"); } catch (UnsupportedEncodingException e1) { e1.printStackTrace(); } MessageDigest md = null; try { md = MessageDigest.getInstance("MD5"); } catch (NoSuchAlgorithmException e1) { e1.printStackTrace(); } byte[] digest = md.digest(bytesOfMessage); BigInteger bigInt = new BigInteger(1, digest); String result = bigInt.toString(16); // fill up with zeros to get a string with length 32 while (result.length() < 32) { result = "0" + result; } return result; } }