Here you can find the source of digestSHA256(byte[] input)
Parameter | Description |
---|---|
input | a parameter |
Parameter | Description |
---|---|
NoSuchAlgorithmException | an exception |
public static byte[] digestSHA256(byte[] input) throws NoSuchAlgorithmException
//package com.java2s; //License from project: Apache License import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; public class Main { /**/* w w w .ja v a 2s . c o m*/ * Performs a final update on the digest using the specified array of bytes, * then completes the digest computation. * @param input * @return * @throws NoSuchAlgorithmException */ public static byte[] digestSHA256(byte[] input) throws NoSuchAlgorithmException { // we do digesting outside the card, because some cards do not support on-card hashing MessageDigest digestEngine = MessageDigest.getInstance("SHA-256"); // we buffer the content to have it after hashing for the PKCS#7 content return digestEngine.digest(input); } }