src/main/java/toy/crypto/DigestMethod.java
/**
     * Hash a given byte array.
     * @param toHash the byte array to hash
     * @return byte array of the hash result
     */
Hash a given byte array.
@param toHash the byte array to hash
@return byte array of the hash result
Hash a given byte array . @param toHash the byte array to hash @return byte array of the hash result
static public byte[] hash(byte[] toHash) {
        MessageDigest digestMethod = null;
        try {
            digestMethod = MessageDigest.getInstance("SHA-256");
        } catch (NoSuchAlgorithmException e) {
            logger.fatal("", e);
        }
        assert digestMethod != null;
        return digestMethod.digest(toHash);
    }
static public byte [ ] hash ( byte [ ] toHash ) { MessageDigest digestMethod = null ; try { digestMethod = MessageDigest . getInstance ( "SHA-256" ) ; } catch ( NoSuchAlgorithmException e ) { logger . fatal ( "" , e ) ; } assert digestMethod != null ; return digestMethod . digest ( toHash ) ; }
Hash a given byte array.
Hash a given byte array .