Here you can find the source of MD5(byte[] source)
public static String MD5(byte[] source)
//package com.java2s; //License from project: Apache License import java.security.MessageDigest; public class Main { public static String MD5(byte[] source) { String s = null;// w ww . j a v a 2s.c o m char[] hexDigits = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' }; try { MessageDigest md = MessageDigest.getInstance("MD5"); md.update(source); byte[] tmp = md.digest(); char[] str = new char[32]; int k = 0; for (int i = 0; i < 16; ++i) { byte byte0 = tmp[i]; str[(k++)] = hexDigits[(byte0 >>> 4 & 0xF)]; str[(k++)] = hexDigits[(byte0 & 0xF)]; } s = new String(str); } catch (Exception e) { e.printStackTrace(); } return s; } }