Java Hash Code Calculate generateHash(String algo, byte[]... bytes)

Here you can find the source of generateHash(String algo, byte[]... bytes)

Description

generate Hash

License

Open Source License

Declaration

public static byte[] generateHash(String algo, byte[]... bytes) 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 {
    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();
    }
}

Related

  1. generateHash(char[] password, byte[] salt)
  2. generateHash(File file)
  3. generateHash(final String data)
  4. generateHash(final String input)
  5. generateHash(final String msg, final String hashAlgorithm)
  6. generateHash(String input)
  7. generateHash(String input, String salt)
  8. generateHash(String item)
  9. generateHash(String plaintext)