Working single shot xchacha20poly1305 encryption and decryption in delegated flavour
This commit is contained in:
1 parent
6228263978
commit
e6f560ba8e
13 files changed
+66
-48
No files matched your search
@@ -1,13 +1,15 @@
|
||||
package com.ionspin.kotlin.crypto.sample
|
||||
|
||||
import com.ionspin.kotlin.crypto.Crypto
|
||||
import com.ionspin.kotlin.crypto.CryptoInitializerDelegated
|
||||
import com.ionspin.kotlin.crypto.CryptoPrimitives
|
||||
import com.ionspin.kotlin.crypto.hash.encodeToUByteArray
|
||||
import com.ionspin.kotlin.crypto.util.toHexString
|
||||
|
||||
object Sample {
|
||||
fun runSample() {
|
||||
println("Initializing crypto library")
|
||||
Crypto.initializeWithCallback {
|
||||
CryptoInitializerDelegated.initializeWithCallback {
|
||||
blake2b()
|
||||
}
|
||||
|
||||
@@ -16,11 +18,11 @@ object Sample {
|
||||
|
||||
fun blake2b() {
|
||||
println("Blake2b updateable")
|
||||
val blake2bUpdateable = Crypto.Blake2b.updateable()
|
||||
val blake2bUpdateable = CryptoPrimitives.Blake2b.updateable()
|
||||
blake2bUpdateable.update("test".encodeToUByteArray())
|
||||
println(blake2bUpdateable.digest().toHexString())
|
||||
println("Blake2b stateless")
|
||||
val statelessResult = Crypto.Blake2b.stateless("test".encodeToByteArray().toUByteArray())
|
||||
val statelessResult = CryptoPrimitives.Blake2b.stateless("test".encodeToByteArray().toUByteArray())
|
||||
println("Blake2b stateless: ${statelessResult.toHexString()}")
|
||||
}
|
||||
}
|
||||
@@ -1,16 +1,5 @@
|
||||
import com.ionspin.kotlin.crypto.hash.blake2b.Blake2bDelegated
|
||||
import com.ionspin.kotlin.crypto.hash.blake2b.Blake2bStateless
|
||||
import com.ionspin.kotlin.crypto.sample.Sample
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.GlobalScope
|
||||
import kotlinx.coroutines.launch
|
||||
import kotlinx.coroutines.runBlocking
|
||||
import platform.posix.pthread_self
|
||||
import platform.posix.sleep
|
||||
import kotlin.native.concurrent.TransferMode
|
||||
import kotlin.native.concurrent.Worker
|
||||
import kotlin.time.ExperimentalTime
|
||||
import kotlin.time.measureTime
|
||||
|
||||
@ExperimentalTime
|
||||
|
||||
|
||||
Reference in new issue
Block a user