mirror of
https://github.com/corda/corda.git
synced 2025-02-20 17:33:15 +00:00
Expose two static fields on SecureHash for Java. (#2822)
This commit is contained in:
parent
27e45bc865
commit
a644741819
@ -82,13 +82,31 @@ sealed class SecureHash(bytes: ByteArray) : OpaqueBytes(bytes) {
|
||||
|
||||
/**
|
||||
* A SHA-256 hash value consisting of 32 0x00 bytes.
|
||||
* This field provides more intuitive access from Java.
|
||||
*/
|
||||
val zeroHash = SecureHash.SHA256(ByteArray(32, { 0.toByte() }))
|
||||
@JvmField
|
||||
val zeroHash: SHA256 = SecureHash.SHA256(ByteArray(32, { 0.toByte() }))
|
||||
|
||||
/**
|
||||
* A SHA-256 hash value consisting of 32 0x00 bytes.
|
||||
* This function is provided for API stability.
|
||||
*/
|
||||
@Suppress("Unused")
|
||||
fun getZeroHash(): SHA256 = zeroHash
|
||||
|
||||
/**
|
||||
* A SHA-256 hash value consisting of 32 0xFF bytes.
|
||||
* This field provides more intuitive access from Java.
|
||||
*/
|
||||
val allOnesHash = SecureHash.SHA256(ByteArray(32, { 255.toByte() }))
|
||||
@JvmField
|
||||
val allOnesHash: SHA256 = SecureHash.SHA256(ByteArray(32, { 255.toByte() }))
|
||||
|
||||
/**
|
||||
* A SHA-256 hash value consisting of 32 0xFF bytes.
|
||||
* This function is provided for API stability.
|
||||
*/
|
||||
@Suppress("Unused")
|
||||
fun getAllOnesHash(): SHA256 = allOnesHash
|
||||
}
|
||||
|
||||
// In future, maybe SHA3, truncated hashes etc.
|
||||
|
Loading…
x
Reference in New Issue
Block a user