Here you can find the source of md5(String input)
public static String md5(String input)
//package com.java2s; //License from project: Open Source License import java.io.UnsupportedEncodingException; import java.math.BigInteger; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; public class Main { public static String md5(String input) { String md5 = null;/*w ww. ja v a2s . co m*/ if (null == input) return null; try { // Create MessageDigest object for MD5 MessageDigest md = MessageDigest.getInstance("MD5"); // Update input string in message digest try { md.update(input.getBytes("utf-8"), 0, input.length()); } catch (UnsupportedEncodingException e) { throw new AssertionError(e); } // Converts message digest value in base 16 (hex) md5 = new BigInteger(1, md.digest()).toString(16); } catch (NoSuchAlgorithmException e) { e.printStackTrace(); } return md5; } }