Here you can find the source of MD5(String str)
public static String MD5(String str)
//package com.java2s; //License from project: Apache License import java.security.*; public class Main { public static String MD5(String str) { if (str == null) return null; StringBuilder sb = new StringBuilder(); try {/*w ww .j a va 2s. com*/ MessageDigest code = MessageDigest.getInstance("MD5"); code.update(str.getBytes()); byte[] bs = code.digest(); for (int i = 0; i < bs.length; i++) { int v = bs[i] & 0xFF; if (v < 16) sb.append(0); sb.append(Integer.toHexString(v)); } } catch (NoSuchAlgorithmException e) { e.printStackTrace(); } return sb.toString().toUpperCase(); } }