mirror of
https://github.com/corda/corda.git
synced 2025-04-10 21:01:11 +00:00
Minor: SecureHash.toString + SecureHash.prefixChars methods
This commit is contained in:
parent
1f68727f31
commit
1c1736ff9f
@ -16,6 +16,10 @@ sealed class SecureHash(bits: ByteArray) : OpaqueBytes(bits) {
|
||||
override val signatureAlgorithmName: String get() = "SHA256withECDSA"
|
||||
}
|
||||
|
||||
override fun toString() = BaseEncoding.base16().encode(bits)
|
||||
|
||||
fun prefixChars(prefixLen: Int = 6) = toString().substring(0, prefixLen)
|
||||
|
||||
// Like static methods in Java, except the 'companion' is a singleton that can have state.
|
||||
companion object {
|
||||
fun parse(str: String) = BaseEncoding.base16().decode(str.toLowerCase()).let {
|
||||
|
Loading…
x
Reference in New Issue
Block a user