Here you can find the source of md5HashBytesToBytes(byte[] buf)
public static byte[] md5HashBytesToBytes(byte[] buf)
//package com.java2s; //License from project: Open Source License import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; public class Main { public static byte[] md5HashBytesToBytes(byte[] buf) { try {//from w w w .j a v a 2s. c o m MessageDigest md = MessageDigest.getInstance("MD5"); md.update(buf); return md.digest(); } catch (NoSuchAlgorithmException e) { throw new RuntimeException(e); } } public static byte[] md5HashBytesToBytes(byte[] buf, int offset, int length) { try { MessageDigest md = MessageDigest.getInstance("MD5"); md.update(buf, offset, length); return md.digest(); } catch (NoSuchAlgorithmException e) { throw new RuntimeException(e); } } }