List of usage examples for org.bouncycastle.crypto.digests KeccakDigest doFinal
public int doFinal(byte[] out, int outOff)
From source file:org.ethereum.crypto.Keccak256Helper.java
License:Open Source License
private static byte[] keccak256(byte[] message, int start, int length, KeccakDigest digest, boolean bouncyencoder) { byte[] hash = new byte[digest.getDigestSize()]; if (message.length != 0) { digest.update(message, start, length); }//from ww w .j a va2 s. c o m digest.doFinal(hash, 0); return hash; }
From source file:org.ethereum.crypto.Keccak256Helper.java
License:Open Source License
private static byte[] doKeccak256(byte[] message, KeccakDigest digest, boolean bouncyencoder) { byte[] hash = new byte[digest.getDigestSize()]; if (message.length != 0) { digest.update(message, 0, message.length); }/*from ww w . j a v a 2 s.c om*/ digest.doFinal(hash, 0); return hash; }
From source file:org.ethereum.crypto.Keccak256Helper.java
License:Open Source License
private static byte[] doKeccak256(byte[] m1, byte[] m2, KeccakDigest digest, boolean bouncyencoder) { byte[] hash = new byte[digest.getDigestSize()]; digest.update(m1, 0, m1.length);/*from ww w .j a v a 2 s . c om*/ digest.update(m2, 0, m2.length); digest.doFinal(hash, 0); return hash; }
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 2s. co m 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); } }