com.syntifi.crypto.key.hash.Sha256 Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of casper-java-sdk Show documentation
Show all versions of casper-java-sdk Show documentation
SDK to streamline the 3rd party Java client integration processes. Such 3rd parties include exchanges & app developers.
The newest version!
package com.syntifi.crypto.key.hash;
import org.bouncycastle.crypto.digests.SHA256Digest;
/**
* Sha256 Hash helper class
*
* @author Alexandre Carvalho
* @author Andre Bertolace
* @since 0.2.0
*/
public final class Sha256 {
/**
* returns a Sha 256 Hash of size length in bytes
*
* @param input byte array to hash
* @return a byte array of size 'length' bytes
*/
public static byte[] digest(byte[] input) {
SHA256Digest d = new SHA256Digest();
d.update(input, 0, input.length);
byte[] result = new byte[d.getDigestSize()];
d.doFinal(result, 0);
return result;
}
}