Here you can find the source of digestMD5(byte[] data)
public static byte[] digestMD5(byte[] data)
//package com.java2s; //License from project: Apache License import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; public class Main { public static final String ALGORITHM_MD5 = "MD5"; public static byte[] digestMD5(byte[] data) { return digest(data, ALGORITHM_MD5); }//w ww . j a v a 2s. c o m public static byte[] digestMD5(byte[] data, byte[] salt) { if (data == null || salt == null) { return null; } byte[] dataSalt = new byte[data.length + salt.length]; System.arraycopy(data, 0, dataSalt, 0, data.length); System.arraycopy(salt, 0, dataSalt, data.length, salt.length); return digestMD5(dataSalt); } public static byte[] digest(byte[] data, String algorithm) { if (data == null || data.length <= 0) { return null; } try { MessageDigest md = MessageDigest.getInstance(algorithm); md.update(data); return md.digest(); } catch (NoSuchAlgorithmException e) { e.printStackTrace(); return null; } } }