public static class SecureHash.Companion
Modifier and Type | Method and Description |
---|---|
SecureHash |
allOnesHashFor(java.lang.String algorithm) |
SecureHash |
componentHashAs(java.lang.String algorithm,
byte[] bytes)
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
interface DigestAlgorithm . |
SecureHash |
create(java.lang.String str)
Converts a SecureHash hash value represented as a {algorithm:}hexadecimal String into a
class SecureHash . |
int |
digestLengthFor(java.lang.String algorithm) |
SecureHash.SHA256 |
getAllOnesHash()
A SHA-256 hash value consisting of 32 0xFF bytes.
This field provides more intuitive access from Java.
|
SecureHash.SHA256 |
getAllOnesHash()
A SHA-256 hash value consisting of 32 0xFF bytes.
This function is provided for API stability.
|
SecureHash.SHA256 |
getZeroHash()
A SHA-256 hash value consisting of 32 0x00 bytes.
This field provides more intuitive access from Java.
|
SecureHash.SHA256 |
getZeroHash()
A SHA-256 hash value consisting of 32 0x00 bytes.
This function is provided for API stability.
|
SecureHash |
hashAs(java.lang.String algorithm,
byte[] bytes)
Computes the hash value of the ByteArray.
|
SecureHash |
nonceHashAs(java.lang.String algorithm,
byte[] bytes)
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
interface DigestAlgorithm . |
SecureHash.SHA256 |
parse(java.lang.String str)
Converts a SHA-256 hash value represented as a hexadecimal String into a
class SecureHash . |
SecureHash |
random(java.lang.String algorithm)
Generates a random hash value.
|
SecureHash.SHA256 |
randomSHA256()
Generates a random SHA-256 value.
|
SecureHash.SHA256 |
sha256(byte[] bytes)
Computes the SHA-256 hash value of the ByteArray.
|
NonExistentClass |
sha256(java.lang.String str)
Computes the SHA-256 hash of the String's UTF-8 byte contents.
|
SecureHash.SHA256 |
sha256Twice(byte[] bytes)
Computes the SHA-256 hash of the ByteArray, and then computes the SHA-256 hash of the hash.
|
SecureHash |
zeroHashFor(java.lang.String algorithm) |
public SecureHash create(java.lang.String str)
Converts a SecureHash hash value represented as a {algorithm:}hexadecimal String into a class SecureHash
.
str
- An optional algorithm id followed by a delimiter and the sequence of hexadecimal digits that represents a hash value.class SecureHash
public SecureHash.SHA256 parse(java.lang.String str)
Converts a SHA-256 hash value represented as a hexadecimal String into a class SecureHash
.
str
- A sequence of 64 hexadecimal digits that represents a SHA-256 hash value.class SecureHash
public int digestLengthFor(java.lang.String algorithm)
algorithm
- The MessageDigest algorithm to query.public SecureHash hashAs(java.lang.String algorithm, byte[] bytes)
Computes the hash value of the ByteArray.
public SecureHash componentHashAs(java.lang.String algorithm, byte[] bytes)
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 interface DigestAlgorithm
.
algorithm
- The MessageDigest algorithm to use.bytes
- The ByteArray to hash.interface DigestAlgorithm
public SecureHash nonceHashAs(java.lang.String algorithm, byte[] bytes)
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 interface DigestAlgorithm
.
algorithm
- The MessageDigest algorithm to use.bytes
- The ByteArray to hash.interface DigestAlgorithm
public SecureHash.SHA256 sha256(byte[] bytes)
Computes the SHA-256 hash value of the ByteArray.
public SecureHash.SHA256 sha256Twice(byte[] bytes)
Computes the SHA-256 hash of the ByteArray, and then computes the SHA-256 hash of the hash.
public NonExistentClass sha256(java.lang.String str)
Computes the SHA-256 hash of the String's UTF-8 byte contents.
public SecureHash.SHA256 randomSHA256()
Generates a random SHA-256 value.
public SecureHash random(java.lang.String algorithm)
Generates a random hash value.
public SecureHash.SHA256 getZeroHash()
A SHA-256 hash value consisting of 32 0x00 bytes. This field provides more intuitive access from Java.
public SecureHash.SHA256 getZeroHash()
A SHA-256 hash value consisting of 32 0x00 bytes. This function is provided for API stability.
public SecureHash.SHA256 getAllOnesHash()
A SHA-256 hash value consisting of 32 0xFF bytes. This field provides more intuitive access from Java.
public SecureHash.SHA256 getAllOnesHash()
A SHA-256 hash value consisting of 32 0xFF bytes. This function is provided for API stability.
public SecureHash zeroHashFor(java.lang.String algorithm)
public SecureHash allOnesHashFor(java.lang.String algorithm)