tuweni / org.apache.tuweni.crypto / Hash

Hash

class Hash (source)

Various utilities for providing hashes (digests) of arbitrary data. Requires the BouncyCastleProvider to be loaded and available. See https://www.bouncycastle.org/wiki/display/JA1/Provider+Installation for detail.

Functions

digestUsingAlgorithm

static fun digestUsingAlgorithm(input: ByteArray, alg: String): ByteArray
static fun digestUsingAlgorithm(input: Bytes, alg: String): Bytes

Helper method to generate a digest using the provided algorithm.

keccak256

static fun keccak256(input: ByteArray): ByteArray
static fun keccak256(input: Bytes): Bytes32

Digest using keccak-256.

keccak512

static fun keccak512(input: ByteArray): ByteArray
static fun keccak512(input: Bytes): Bytes

Digest using keccak-512.

sha2_256

static fun sha2_256(input: ByteArray): ByteArray
static fun sha2_256(input: Bytes): Bytes32

Digest using SHA2-256.

sha2_512_256

static fun sha2_512_256(input: ByteArray): ByteArray

Digest using SHA2-512/256.

static fun sha2_512_256(input: Bytes): Bytes32

Digest using SHA-512/256.

sha3_256

static fun sha3_256(input: ByteArray): ByteArray
static fun sha3_256(input: Bytes): Bytes32

Digest using SHA3-256.

sha3_512

static fun sha3_512(input: ByteArray): ByteArray
static fun sha3_512(input: Bytes): Bytes

Digest using SHA3-512.