class chacha20 :?iv:string -> ?ctr:int64 -> string ->
stream_cipher
The Chacha20 stream cipher.
The string argument is the key, and must be of length 16 or 32.
The optional iv
argument is the initialization vector
(also known as the nonce). If present, it must be 8 bytes long.
If absent, it is taken to be eight zero bytes.
The optional ctr
argument is the initial value of the internal
counter. If absent, it is taken to be 0.
This stream cipher works by xor-ing the input with the
output of a key-dependent pseudo random number generator.
Thus, decryption is the same function as encryption.