Java Code Examples for org.spongycastle.crypto.digests.SHA3Digest#update()

The following examples show how to use org.spongycastle.crypto.digests.SHA3Digest#update() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Hash.java    From neb.java with GNU Lesser General Public License v3.0 5 votes vote down vote up
public static byte[] Sha3256(byte[]... args) {
    SHA3Digest digest = new SHA3Digest();
    for (int i = 0; i < args.length; i++) {
        byte[] bytes = args[i];
        digest.update(bytes, 0, bytes.length);
    }
    byte[] out = new byte[256 / 8];
    digest.doFinal(out, 0);
    return out;
}
 
Example 2
Source File: SHA3Helper.java    From wkcwallet-java with Apache License 2.0 5 votes vote down vote up
private static byte[] sha3(byte[] message, int start, int length, SHA3Digest digest, boolean bouncyencoder) {
    byte[] hash = new byte[digest.getDigestSize()];

    if (message.length != 0) {
        digest.update(message, start, length);
    }
    digest.doFinal(hash, 0);
    return hash;
}
 
Example 3
Source File: SHA3Helper.java    From wkcwallet-java with Apache License 2.0 5 votes vote down vote up
private static byte[] doSha3(byte[] message, SHA3Digest digest, boolean bouncyencoder) {
    byte[] hash = new byte[digest.getDigestSize()];

    if (message.length != 0) {
        digest.update(message, 0, message.length);
    }
    digest.doFinal(hash, 0);
    return hash;
}
 
Example 4
Source File: SHA3Helper.java    From wkcwallet-java with Apache License 2.0 5 votes vote down vote up
private static byte[] doSha3(byte[] m1, byte[] m2, SHA3Digest digest, boolean bouncyencoder) {
    byte[] hash = new byte[digest.getDigestSize()];
    digest.update(m1, 0, m1.length);
    digest.update(m2, 0, m2.length);

    digest.doFinal(hash, 0);
    return hash;
}
 
Example 5
Source File: SHA3Helper.java    From ethereumj with MIT License 5 votes vote down vote up
private static byte[] doSha3(byte[] message, SHA3Digest digest, boolean bouncyencoder) {
    byte[] hash = new byte[digest.getDigestSize()];

    if (message.length != 0) {
        digest.update(message, 0, message.length);
    }
    digest.doFinal(hash, 0);
    return hash;
}