Implemeting _stream_ primitives, at elast the ones available in lazy sodium

This commit is contained in:
Ugljesa Jovanovic committed 2020-10-11 19:47:23 +02:00
1 parent 8d782d2932
commit a18355adae
4 files changed
+242 -7

No files matched your search

@@ -0,0 +1,21 @@
package com.ionspin.kotlin.crypto.stream
/**
* Created by Ugljesa Jovanovic
* ugljesa.jovanovic@ionspin.com
* on 11-Oct-2020
*/
const val crypto_stream_chacha20_KEYBYTES = 32
const val crypto_stream_chacha20_NONCEBYTES = 8
const val crypto_stream_chacha20_ietf_KEYBYTES = 32
const val crypto_stream_chacha20_ietf_NONCEBYTES = 12
expect object Stream {
fun chacha20(clen: Int, nonce: UByteArray, key: UByteArray) : UByteArray
fun chacha20IetfXor(message : UByteArray, nonce: UByteArray, key: UByteArray) : UByteArray
fun chacha20IetfXorIc(message : UByteArray, nonce: UByteArray, initialCounter: ULong, key: UByteArray) : UByteArray
fun chacha20Keygen() : UByteArray
fun chacha20Xor(message : UByteArray, nonce: UByteArray, key: UByteArray) : UByteArray
fun chacha20XorIc(message : UByteArray, nonce: UByteArray, initialCounter: ULong, key: UByteArray) : UByteArray
}