Pivot to a handled API, update common js and native generators

This commit is contained in:
Ugljesa Jovanovic authored and Ugljesa Jovanovic committed 2020-08-08 16:20:56 +02:00
1 parent d8b92a6970
commit 1f0eaf59ca
12 files changed
+419 -258

No files matched your search

@@ -1,6 +1,7 @@
package debug.test
import com.ionspin.kotlin.crypto.getSodium
import ext.libsodium.com.ionspin.kotlin.crypto.toUByteArray
import ext.libsodium.com.ionspin.kotlin.crypto.toUInt8Array
import kotlin.Any
import kotlin.Int
@@ -13,42 +14,38 @@ actual typealias Sha512State = Any
actual typealias GenericHashState = Any
actual class Crypto {
actual fun crypto_hash_sha256_init(state: Sha256State): Int {
actual fun crypto_hash_sha256_init(): dynamic {
println("Debug")
return getSodium().crypto_hash_sha256_init(state)
return getSodium().crypto_hash_sha256_init()
}
actual fun crypto_hash_sha256_update(state: Sha256State, input: UByteArray) {
println("Debug")
getSodium().crypto_hash_sha256_update(state, input.toUInt8Array(), input.size.toLong())
getSodium().crypto_hash_sha256_update(state, input.toUInt8Array(), )
}
actual fun crypto_hash_sha256_final(state: Sha256State, out: UByteArray) {
actual fun crypto_hash_sha256_final(state: Sha256State): UByteArray {
println("Debug")
getSodium().crypto_hash_sha256_final(state, out.toUInt8Array())
return getSodium().crypto_hash_sha256_final(state).toUByteArray()
}
actual fun crypto_hash_sha512_init(state: Sha512State): Int {
actual fun crypto_hash_sha512_init(): dynamic {
println("Debug")
return getSodium().crypto_hash_sha512_init(state)
return getSodium().crypto_hash_sha512_init()
}
actual fun crypto_hash_sha512_update(state: Sha512State, input: UByteArray) {
println("Debug")
getSodium().crypto_hash_sha512_update(state, input.toUInt8Array(), input.size.toLong())
getSodium().crypto_hash_sha512_update(state, input.toUInt8Array(), )
}
actual fun crypto_hash_sha512_final(state: Sha512State, out: UByteArray) {
actual fun crypto_hash_sha512_final(state: Sha512State): UByteArray {
println("Debug")
getSodium().crypto_hash_sha512_final(state, out.toUInt8Array())
return getSodium().crypto_hash_sha512_final(state).toUByteArray()
}
actual fun crypto_generichash_init(
state: GenericHashState,
key: UByteArray,
outlen: Int
): Int {
actual fun crypto_generichash_init(key: UByteArray, outlen: Int): dynamic {
println("Debug")
return getSodium().crypto_generichash_init(state, key.toUInt8Array(), key.size, outlen)
return getSodium().crypto_generichash_init(key.toUInt8Array(), outlen)
}
}