This commit is contained in:
Ugljesa Jovanovic authored and Ugljesa Jovanovic committed 2020-07-31 17:37:49 +02:00
1 parent 53325cdba6
commit c5082a0f47
8 files changed
+226 -33

No files matched your search

@@ -0,0 +1,19 @@
package debug.test
import Sha256State
import kotlin.Int
import kotlin.UByteArray
expect class Sha256State
expect class Hashing {
fun init(state: Sha256State): Int
}
expect class GenericHash {
fun init(
state: UByteArray,
key: UByteArray,
outlen: Int
): Int
}
@@ -0,0 +1,29 @@
package debug.test
import Sha256State
import com.goterl.lazycode.lazysodium.SodiumJava
import com.goterl.lazycode.lazysodium.interfaces.Hash
import kotlin.Int
import kotlin.UByteArray
val sodium: SodiumJava = SodiumJava()
actual typealias Sha256State = Hash.State256
actual class Hashing {
actual fun init(state: Sha256State): Int {
println("Debug")
return sodium.crypto_hash_sha256_init(state)
}
}
actual class GenericHash {
actual fun init(
state: UByteArray,
key: UByteArray,
outlen: Int
): Int {
println("Debug")
return sodium.crypto_generichash_init(state.asByteArray(), key.asByteArray(), key.size, outlen)
}
}
@@ -0,0 +1,5 @@
package debug.test
import libsodium.crypto_hash_sha256_state
actual typealias Sha256State = crypto_hash_sha256_state