Added a bunch, also added xchacha20 ic and xor
This commit is contained in:
11 files changed
+473
-81
No files matched your search
+4
@@ -232,6 +232,10 @@ interface JsSodiumInterface {
|
||||
fun crypto_stream_chacha20_xor(message : Uint8Array, nonce: Uint8Array, key: Uint8Array) : Uint8Array
|
||||
fun crypto_stream_chacha20_xor_ic(message : Uint8Array, nonce: Uint8Array, initialCounter: UInt, key: Uint8Array) : Uint8Array
|
||||
|
||||
fun crypto_stream_xchacha20_keygen() : Uint8Array
|
||||
fun crypto_stream_xchacha20_xor(message : Uint8Array, nonce: Uint8Array, key: Uint8Array) : Uint8Array
|
||||
fun crypto_stream_xchacha20_xor_ic(message : Uint8Array, nonce: Uint8Array, initialCounter: UInt, key: Uint8Array) : Uint8Array
|
||||
|
||||
// ---- Stream end ----
|
||||
|
||||
// ---- Scalar multiplication ----
|
||||
|
||||
+38
@@ -79,4 +79,42 @@ actual object Stream {
|
||||
|
||||
return result.toUByteArray()
|
||||
}
|
||||
|
||||
actual fun xChacha20Keygen(): UByteArray {
|
||||
val result = getSodium().crypto_stream_xchacha20_keygen()
|
||||
|
||||
return result.toUByteArray()
|
||||
}
|
||||
|
||||
actual fun xChacha20Xor(
|
||||
message: UByteArray,
|
||||
nonce: UByteArray,
|
||||
key: UByteArray
|
||||
): UByteArray {
|
||||
val result = getSodium().crypto_stream_xchacha20_xor(
|
||||
message.toUInt8Array(),
|
||||
nonce.toUInt8Array(),
|
||||
key.toUInt8Array()
|
||||
)
|
||||
|
||||
return result.toUByteArray()
|
||||
}
|
||||
|
||||
actual fun xChacha20XorIc(
|
||||
message: UByteArray,
|
||||
nonce: UByteArray,
|
||||
initialCounter: ULong,
|
||||
key: UByteArray
|
||||
): UByteArray {
|
||||
val result = getSodium().crypto_stream_xchacha20_xor_ic(
|
||||
message.toUInt8Array(),
|
||||
nonce.toUInt8Array(),
|
||||
initialCounter.toUInt(),
|
||||
key.toUInt8Array()
|
||||
)
|
||||
|
||||
return result.toUByteArray()
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user