Further API conversion

This commit is contained in:
Ugljesa Jovanovic authored and Ugljesa Jovanovic committed 2020-06-23 21:39:04 +02:00
1 parent 233ee1bf55
commit 1848de0e8d
24 files changed
+481 -317

No files matched your search

@@ -1,8 +1,6 @@
package com.ionspin.kotlin.crypto.hash.blake2b
import com.ionspin.kotlin.crypto.getSodium
import com.ionspin.kotlin.crypto.hash.sha.Sha256StatelessDelegated
import com.ionspin.kotlin.crypto.util.toHexString
import org.khronos.webgl.Uint8Array
import org.khronos.webgl.get
@@ -13,7 +11,7 @@ import org.khronos.webgl.get
*/
actual class Blake2bDelegated actual constructor(key: UByteArray?, val hashLength: Int) : Blake2b {
actual class Blake2bDelegated actual constructor(key: UByteArray?, val hashLength: Int) : Blake2bMultipart {
override val MAX_HASH_BYTES: Int = 64
@@ -43,7 +41,7 @@ actual class Blake2bDelegated actual constructor(key: UByteArray?, val hashLengt
actual object Blake2bDelegatedStateless : Blake2bStateless {
actual object Blake2bDelegatedStateless : Blake2b {
override val MAX_HASH_BYTES: Int = 64
override fun digest(inputMessage: UByteArray, key: UByteArray, hashLength: Int): UByteArray {
@@ -59,4 +57,4 @@ actual object Blake2bDelegatedStateless : Blake2bStateless {
}
}
}
@@ -1,6 +1,5 @@
package com.ionspin.kotlin.crypto.hash.sha
import com.ionspin.kotlin.crypto.getSodium
import com.ionspin.kotlin.crypto.getSodium
import org.khronos.webgl.Uint8Array
@@ -35,7 +34,7 @@ actual class Sha512Delegated : Sha512 {
}
actual object Sha512StatelessDelegated : StatelessSha512 {
actual object Sha512StatelessDelegated : MultipartSha512 {
override fun digest(inputMessage: UByteArray): UByteArray {
val hashed = getSodium().crypto_hash_sha512(Uint8Array(inputMessage.toByteArray().toTypedArray()))
@@ -45,4 +44,4 @@ actual object Sha512StatelessDelegated : StatelessSha512 {
}
return hash
}
}
}