Here you can find the source of md5(String str)
public static String md5(String str)
//package com.java2s; import java.security.MessageDigest; public class Main { public static String md5(String str) { try {/*from w ww . ja v a 2s .c o m*/ MessageDigest md = MessageDigest.getInstance("MD5"); md.update(str.getBytes()); byte[] b = md.digest(); StringBuffer sb = new StringBuffer(); for (int i = 0; i < b.length; i++) { int v = (int) b[i]; v = v < 0 ? 0x100 + v : v; String cc = Integer.toHexString(v); if (cc.length() == 1) sb.append('0'); sb.append(cc); } return sb.toString(); } catch (Exception e) { } return ""; } }