Here you can find the source of digestBytes(String type, byte[]... data)
Parameter | Description |
---|---|
type | desired digest method |
data | 0 or more arrays to digest |
public static byte[] digestBytes(String type, byte[]... data) throws NoSuchAlgorithmException
//package com.java2s; //License from project: Open Source License import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; public class Main { /**/*from w w w .j a va 2 s .co m*/ * digests all byte arrays via the method provided * @param type desired digest method * @param data 0 or more arrays to digest * @return the output of the digest operation */ public static byte[] digestBytes(String type, byte[]... data) throws NoSuchAlgorithmException { MessageDigest md = MessageDigest.getInstance(type); for (int i = 0; i < data.length; i++) { md.update(data[i]); } return md.digest(); } }