CRYPTO.StreamSecret-key encryption.
The primitive is xsalsa20, NaCl documentation.
module Secret_key : sig ... endSecret keys.
module Nonce : sig ... endNonces.
val stream : secret_key:Secret_key.t -> nonce:Nonce.t -> length:int -> Bytes.tstream ~secret_key ~nonce ~length generates a pseudo-random byte stream of length length based on secret_key and nonce. This can be xored with your plain or cipher text to encrypt or decrypt. xor does that directly for you.
val xor : secret_key:Secret_key.t -> nonce:Nonce.t -> stream:Bytes.t -> Bytes.txor ~secret_key ~nonce ~stream is the result of encrypting or decrypting stream using nonce and secret_key.