Here you can find the source of generateHash(String algo, byte[]... bytes)
public static byte[] generateHash(String algo, byte[]... bytes) throws NoSuchAlgorithmException
//package com.java2s; //License from project: Open Source License import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; public class Main { public static byte[] generateHash(String algo, byte[]... bytes) throws NoSuchAlgorithmException { MessageDigest digest = MessageDigest.getInstance(algo); for (int i = 0; i < bytes.length; ++i) { digest.update(bytes[i]);/*from w w w .ja v a 2 s . c om*/ } return digest.digest(); } }