corda / net.corda.core.crypto / SecureHash / Companion

Companion

companion object Companion : Internable<SecureHash>

Companion Object Properties

allOnesHash

A SHA-256 hash value consisting of 32 0xFF bytes. This field provides more intuitive access from Java.

val allOnesHash: SHA256

DELIMITER

const val DELIMITER: Char

interner

val interner: PrivateInterner<SecureHash>

SHA2_256

const val SHA2_256: String

SHA2_384

const val SHA2_384: String

SHA2_512

const val SHA2_512: String

zeroHash

A SHA-256 hash value consisting of 32 0x00 bytes. This field provides more intuitive access from Java.

val zeroHash: SHA256

Companion Object Functions

allOnesHashFor

fun allOnesHashFor(algorithm: String): SecureHash

componentHashAs

Computes the digest of the ByteArray which is resistant to pre-image attacks. It computes the hash of the hash for SHA2-256 and other algorithms loaded via JCA MessageDigest. For custom algorithms the strategy can be modified via DigestAlgorithm.

fun componentHashAs(algorithm: String, bytes: ByteArray): SecureHash

create

Converts a SecureHash hash value represented as a {algorithm:}hexadecimal String into a SecureHash.

fun create(str: String?): SecureHash

createSHA256

Factory method for SHA256 to be used in preference to the constructor.

fun createSHA256(bytes: ByteArray): SHA256

digestLengthFor

fun digestLengthFor(algorithm: String): Int

getAllOnesHash

A SHA-256 hash value consisting of 32 0xFF bytes. This function is provided for API stability.

fun getAllOnesHash(): SHA256

getZeroHash

A SHA-256 hash value consisting of 32 0x00 bytes. This function is provided for API stability.

fun getZeroHash(): SHA256

hashAs

Computes the hash value of the ByteArray.

fun hashAs(algorithm: String, bytes: ByteArray): SecureHash

nonceHashAs

Computes the digest of the ByteArray which is resistant to pre-image attacks. It computes the hash of the hash for SHA2-256 and other algorithms loaded via JCA MessageDigest. For custom algorithms the strategy can be modified via DigestAlgorithm.

fun nonceHashAs(algorithm: String, bytes: ByteArray): SecureHash

parse

Converts a SHA-256 hash value represented as a hexadecimal String into a SecureHash.

fun parse(str: String?): SHA256

random

Generates a random hash value.

fun random(algorithm: String): SecureHash

randomSHA256

Generates a random SHA-256 value.

fun randomSHA256(): SHA256

sha256

Computes the SHA-256 hash value of the ByteArray.

fun sha256(bytes: ByteArray): SHA256

Computes the SHA-256 hash of the String's UTF-8 byte contents.

fun sha256(str: String): SHA256

sha256Twice

Computes the SHA-256 hash of the ByteArray, and then computes the SHA-256 hash of the hash.

fun sha256Twice(bytes: ByteArray): SHA256

zeroHashFor

fun zeroHashFor(algorithm: String): SecureHash