Added generichash keygen
This commit is contained in:
1 parent
16cb5c2dee
commit
1878144b8f
6 files changed
+27
-2
No files matched your search
+9
@@ -10,6 +10,7 @@ import kotlinx.cinterop.reinterpret
|
||||
import libsodium.crypto_generichash
|
||||
import libsodium.crypto_generichash_final
|
||||
import libsodium.crypto_generichash_init
|
||||
import libsodium.crypto_generichash_keygen
|
||||
import libsodium.crypto_generichash_update
|
||||
import platform.posix.malloc
|
||||
|
||||
@@ -88,5 +89,13 @@ actual object GenericHash {
|
||||
return hashResult
|
||||
}
|
||||
|
||||
actual fun genericHashKeygen(): UByteArray {
|
||||
val generatedKey = UByteArray(crypto_generichash_BYTES)
|
||||
val generatedKeyPinned = generatedKey.pin()
|
||||
crypto_generichash_keygen(generatedKeyPinned.toPtr())
|
||||
generatedKeyPinned.unpin()
|
||||
return generatedKey
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user