Example usage for org.bouncycastle.crypto.digests KeccakDigest update

List of usage examples for org.bouncycastle.crypto.digests KeccakDigest update

Introduction

In this page you can find the example usage for org.bouncycastle.crypto.digests KeccakDigest update.

Prototype

public void update(byte in) 

Source Link

Usage

From source file:uk.co.platosys.dinigma.Digester.java

License:GNU General Public License

/**Takes a byte array and returns a string which is
 * the Base64 encoded version the digest.
 * This uses SHA3-512 as the digest algorithm.
 *
 * *///from   w  w  w.  j a  v  a 2  s  .com
public static String digest(byte[] bytes) throws MinigmaException {
    try {
        KeccakDigest digest = new SHA3Digest(512);
        for (byte byt : bytes) {
            digest.update(byt);
        }
        byte[] digested = new byte[digest.getDigestSize()];
        digest.doFinal(digested, 0);
        return (MinigmaUtils.encode(digested));
    } catch (Exception e) {

        throw new MinigmaException("error making digest", e);
    }
}