Here you can find the source of md5(String orgin)
public static String md5(String orgin)
//package com.java2s; //License from project: Open Source License import java.security.MessageDigest; public class Main { public static String md5(String orgin) { try {// ww w .j av a 2 s .c o m MessageDigest md = MessageDigest.getInstance("MD5"); String result = byte2hex(md.digest(orgin.toString().getBytes("utf-8"))); return result; } catch (Exception e) { throw new java.lang.RuntimeException("sign error !"); } } private static String byte2hex(byte[] b) { String hs = ""; String stmp = ""; for (int n = 0; n < b.length; n++) { stmp = (java.lang.Integer.toHexString(b[n] & 0XFF)); if (stmp.length() == 1) hs = hs + "0" + stmp; else hs = hs + stmp; } return hs.toUpperCase(); } }