Removed digest from stateless has interface and pushed it down, as some hashes don't support keys or different hash lengths

This commit is contained in:
Ugljesa Jovanovic authored and Ugljesa Jovanovic committed 2020-06-07 11:59:46 +02:00
1 parent 03275dd44c
commit 9c9383d54f
12 files changed
+27 -20

No files matched your search

@@ -39,11 +39,6 @@ interface UpdatableHash : Hash {
interface StatelessHash : Hash {
fun digest(
inputMessage: UByteArray = ubyteArrayOf(),
key: UByteArray = ubyteArrayOf(),
hashLength: Int = MAX_HASH_BYTES
): UByteArray
}
fun String.encodeToUByteArray() : UByteArray{
@@ -21,5 +21,11 @@ interface Blake2b : UpdatableHash {
interface Blake2bStateless : StatelessHash {
override val MAX_HASH_BYTES: Int
get() = Blake2bProperties.MAX_HASH_BYTES
fun digest(
inputMessage: UByteArray = ubyteArrayOf(),
key: UByteArray = ubyteArrayOf(),
hashLength: Int = MAX_HASH_BYTES
): UByteArray
}
@@ -19,4 +19,8 @@ interface Sha256 : UpdatableHash {
interface StatelessSha256 : StatelessHash {
override val MAX_HASH_BYTES: Int
get() = Sha256Properties.MAX_HASH_BYTES
fun digest(
inputMessage: UByteArray = ubyteArrayOf()
): UByteArray
}
@@ -18,4 +18,8 @@ interface Sha512 : UpdatableHash {
interface StatelessSha512 : StatelessHash {
override val MAX_HASH_BYTES: Int
get() = Sha256Properties.MAX_HASH_BYTES
fun digest(
inputMessage: UByteArray = ubyteArrayOf()
): UByteArray
}