sealed class SecureHash : OpaqueBytes
Container for a cryptographically secure hash value. Provides utilities for generating a cryptographic hash using different algorithms (currently only SHA-256 supported).
class HASH : SecureHash |
|
class SHA256 : SecureHash
SHA-256 is part of the SHA-2 hash function family. Generated hash is fixed size, 256-bits (32-bytes). |
val bytes: ByteArray
The bytes are always cloned so that this object becomes immutable. This has been done to prevent tampering with entities such as net.corda.core.crypto.SecureHash and net.corda.core.contracts.PrivacySalt, as well as preserve the integrity of our hash constants net.corda.core.crypto.SecureHash.zeroHash and net.corda.core.crypto.SecureHash.allOnesHash. |
fun concatenate(other: SecureHash): SecureHash
Append a second hash value to this hash value, and then compute the hash of the result. |
|
fun concatenateAs(concatAlgorithm: String, other: SecureHash): SecureHash
Append a second hash value to this hash value, and then compute the hash of the result using the specified algorithm. |
|
open fun generate(data: ByteArray): SecureHash |
|
fun hashConcat(other: SecureHash): <ERROR CLASS>
Append a second hash value to this hash value, and then compute the SHA-256 hash of the result. |
|
fun prefixChars(prefixLen: Int = 6): <ERROR CLASS>
Returns the first prefixLen hexadecimal digits of the SecureHash value. |
|
fun reHash(): SecureHash |
|
fun toHexString(): String |
|
open fun toString(): String |
const val DELIMITER: Char |
|
const val SHA2_256: String |
|
const val SHA2_384: String |
|
const val SHA2_512: String |
|
val allOnesHash: SHA256
A SHA-256 hash value consisting of 32 0xFF bytes. This field provides more intuitive access from Java. |
|
val zeroHash: SHA256
A SHA-256 hash value consisting of 32 0x00 bytes. This field provides more intuitive access from Java. |
fun allOnesHashFor(algorithm: String): SecureHash |
|
fun componentHashAs(algorithm: String, bytes: ByteArray): SecureHash
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 create(str: String?): SecureHash
Converts a SecureHash hash value represented as a {algorithm:}hexadecimal String into a SecureHash. |
|
fun digestLengthFor(algorithm: String): Int |
|
fun getAllOnesHash(): SHA256
A SHA-256 hash value consisting of 32 0xFF bytes. This function is provided for API stability. |
|
fun getZeroHash(): SHA256
A SHA-256 hash value consisting of 32 0x00 bytes. This function is provided for API stability. |
|
fun hashAs(algorithm: String, bytes: ByteArray): SecureHash
Computes the hash value of the ByteArray. |
|
fun nonceHashAs(algorithm: String, bytes: ByteArray): SecureHash
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 parse(str: String?): SHA256
Converts a SHA-256 hash value represented as a hexadecimal String into a SecureHash. |
|
fun random(algorithm: String): SecureHash
Generates a random hash value. |
|
fun randomSHA256(): SHA256
Generates a random SHA-256 value. |
|
fun sha256(bytes: ByteArray): SHA256
Computes the SHA-256 hash value of the ByteArray. fun sha256(str: String): <ERROR CLASS>
Computes the SHA-256 hash of the String's UTF-8 byte contents. |
|
fun sha256Twice(bytes: ByteArray): SHA256
Computes the SHA-256 hash of the ByteArray, and then computes the SHA-256 hash of the hash. |
|
fun zeroHashFor(algorithm: String): SecureHash |
val SecureHash.algorithm: String
Hash algorithm. |
|
val OpaqueBytes.isZero: Boolean |
fun Any.contextLogger(): <ERROR CLASS>
When called from a companion object, returns the logger for the enclosing class. |
|
fun <T : Any> ByteSequence.deserialize(serializationFactory: SerializationFactory = SerializationFactory.defaultFactory, context: SerializationContext = serializationFactory.defaultContext): T
Convenience extension method for deserializing a ByteSequence, utilising the defaults. |
|
fun <T : Any> ByteSequence.deserializeWithCompatibleContext(serializationFactory: SerializationFactory = SerializationFactory.defaultFactory, context: SerializationContext = serializationFactory.defaultContext): ObjectWithCompatibleContext<T>
Additionally returns SerializationContext which was used for encoding. It might be helpful to know SerializationContext to use the same encoding in the reply. |
|
fun OpaqueBytes.hashAs(algorithm: String): SecureHash
Compute the algorithm hash for the contents of the OpaqueBytes. |
|
fun OpaqueBytes.sha256(): SHA256
Compute the SHA-256 hash for the contents of the OpaqueBytes. |
class HASH : SecureHash |
|
class SHA256 : SecureHash
SHA-256 is part of the SHA-2 hash function family. Generated hash is fixed size, 256-bits (32-bytes). |