Java Hash Code Calculate generateHash(byte[] data)

Here you can find the source of generateHash(byte[] data)

Description

generate Hash

License

Open Source License

Declaration

public static byte[] generateHash(byte[] data) 

Method Source Code


//package com.java2s;
//License from project: MIT License 

import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;

public class Main {
    public static byte[] generateHash(byte[] data) {
        MessageDigest sha = null;
        try {/*from  www  .  ja  va  2 s  . c  o  m*/
            sha = MessageDigest.getInstance("SHA-256");
        } catch (NoSuchAlgorithmException e) {
            e.printStackTrace();
        }
        sha.update(data);
        return sha.digest();
    }
}

Related

  1. combineHashes(int hash1, int hash2)
  2. combineHashesBad(int hash1, int hash2)
  3. combineHashesMurmur(int hash2, int hash1)
  4. combineHashesOld(int hash1, int hash2)
  5. combineHashesUnsorted(final int a, final int b)
  6. generateHash(char[] password, byte[] salt)
  7. generateHash(File file)
  8. generateHash(final String data)
  9. generateHash(final String input)