From 60f29339ee3d5a019fd20ca0399d96bbfd7b99fb Mon Sep 17 00:00:00 2001 From: Mike Hearn Date: Fri, 27 Nov 2015 15:42:55 +0100 Subject: [PATCH] Minor: add a convenience extension function to convert from byte arrays to SHA256 hashes. --- src/core/Crypto.kt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/core/Crypto.kt b/src/core/Crypto.kt index 3fa8617d6f..fb000511b4 100644 --- a/src/core/Crypto.kt +++ b/src/core/Crypto.kt @@ -32,6 +32,8 @@ sealed class SecureHash(bits: ByteArray) : OpaqueBytes(bits) { // In future, maybe SHA3, truncated hashes etc. } +fun ByteArray.sha256(): SecureHash.SHA256 = SecureHash.sha256(this) + /** * A wrapper around a digital signature. The covering field is a generic tag usable by whatever is interpreting the * signature. It isn't used currently, but experience from Bitcoin suggests such a feature is useful, especially when