Java Digest digestBytes(String type, byte[]... data)

Here you can find the source of digestBytes(String type, byte[]... data)

Description

digests all byte arrays via the method provided

License

Open Source License

Parameter

Parameter Description
type desired digest method
data 0 or more arrays to digest

Return

the output of the digest operation

Declaration

public static byte[] digestBytes(String type, byte[]... data) throws NoSuchAlgorithmException 

Method Source Code

//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();
    }
}

Related

  1. digest(String uri)
  2. digest(String value, byte[] salt, int iterations)
  3. digest(String value, String algorithm)
  4. digestBased(String text)
  5. digestBySHA256(byte[] source)
  6. digestEncrypte(byte[] plainText, String algorithm)
  7. digestHex(String txt)
  8. digestHmacToBase64(String algorithm, String msg, byte[] privateKey)
  9. digestInit()