Here you can find the source of generateHash(byte[] data)
public static byte[] generateHash(byte[] data)
//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(); } }