Example usage for org.bouncycastle.crypto.digests SHA3Digest reset

List of usage examples for org.bouncycastle.crypto.digests SHA3Digest reset

Introduction

In this page you can find the example usage for org.bouncycastle.crypto.digests SHA3Digest reset.

Prototype

public void reset() 

Source Link

Usage

From source file:org.thingsboard.server.common.msg.EncryptionUtil.java

License:Apache License

public static String getSha3Hash(String data) {
    String trimmedData = trimNewLines(data);
    byte[] dataBytes = trimmedData.getBytes();
    SHA3Digest md = new SHA3Digest(256);
    md.reset();
    md.update(dataBytes, 0, dataBytes.length);
    byte[] hashedBytes = new byte[256 / 8];
    md.doFinal(hashedBytes, 0);//from w  w  w.  j  a va  2s .c o m
    String sha3Hash = ByteUtils.toHexString(hashedBytes);
    return sha3Hash;
}