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

@@ -64,14 +64,7 @@ class Sha256Pure : Sha256 {
)
fun digest(inputString: String, key: String?, hashLength: Int): UByteArray {
return digest(
inputString.encodeToByteArray().toUByteArray(),
key?.run { encodeToByteArray().toUByteArray()} ?: ubyteArrayOf(),
hashLength)
}
override fun digest(inputMessage: UByteArray, key: UByteArray, hashLength: Int): UByteArray {
override fun digest(inputMessage: UByteArray): UByteArray {
var h = iv.copyOf()
@@ -132,7 +132,7 @@ class Sha512Pure : Sha512 {
)
override fun digest(inputMessage: UByteArray, key: UByteArray, hashLength: Int): UByteArray {
override fun digest(inputMessage: UByteArray): UByteArray {
var h = iv.copyOf()