Here you can find the source of md5(final String input)
public static String md5(final String input)
//package com.java2s; //License from project: Apache License import java.security.MessageDigest; public class Main { public static String md5(final String input) { try {//from w w w .j a v a 2 s. c o m MessageDigest md = MessageDigest.getInstance("MD5"); md.update(input.getBytes()); byte[] output = md.digest(); return bytesToHex(output); } catch (Exception e) { e.printStackTrace(); } return input; } public static String bytesToHex(byte[] b) { char hexDigit[] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' }; StringBuffer buf = new StringBuffer(); for (int j = 0; j < b.length; j++) { buf.append(hexDigit[(b[j] >> 4) & 0x0f]); buf.append(hexDigit[b[j] & 0x0f]); } return buf.toString(); } public static String toString(Object obj) { if (null == obj) return null; return String.valueOf(obj); } }