Forgot to add files

This commit is contained in:
Ugljesa Jovanovic authored and Ugljesa Jovanovic committed 2020-06-01 20:38:33 +02:00
1 parent 293fd37bad
commit 8a4eb512c4
7 files changed
+102 -37

No files matched your search

@@ -31,7 +31,7 @@ actual object SRNG {
actual fun getRandomBytes(amount: Int): UByteArray {
memScoped {
val array = allocArray<UByteVar>(amount)
randombytes_buf(array, amount.toULong())
randombytes_buf(array, amount.toUInt())
return UByteArray(amount) {
array[it]
}
@@ -38,11 +38,11 @@ actual object Blake2bStateless : Blake2bStatelessInterface {
val hashResultPinned = hashResult.pin()
crypto_generichash(
hashResultPinned.addressOf(0),
hashLength.toULong(),
hashLength.toUInt(),
inputString.encodeToByteArray().toUByteArray().toCValues(),
inputString.length.toULong(),
key?.run { this.encodeToByteArray().toUByteArray().toCValues() },
key?.length?.toULong() ?: 0UL
key?.length?.toUInt() ?: 0U
)
println("HashPointer: ${hashResult.toHexString()}")
println(hashResult.toHexString())
@@ -54,11 +54,11 @@ actual object Blake2bStateless : Blake2bStatelessInterface {
crypto_generichash(
StableRef.create(hashResult).asCPointer().reinterpret(),
hashLength.toULong(),
hashLength.toUInt(),
inputMessage.toCValues(),
inputMessage.size.toULong(),
key.toCValues(),
key.size.toULong() ?: 0UL
key.size.toUInt() ?: 0U
)
println("HashPointer: ${hashResult.toHexString()}")
println(hashResult.toHexString())