Module Chacha
ChaCha, a variant of Salsa20 specifies a ChaCha20 encryption function as well as a set of reduced Chacha8 and Chacha12 encryption functions.
val create : ?hash:(Cstruct.t -> Cstruct.t) -> Cstruct.t -> Cstruct.t -> t
create key nonce
isstate
, the ChaCha20 encryption/decryption function state.hash
is Chacha_core.chacha20_core by default (recommended), Chacha_core.chacha12 or Chacha_core.chacha8 could also be used instead.key
is either a 32 (recommended) or 16 bytes.nonce
is 8 bytes.- raises Invalid_argument
if
key
ornonce
is not of the correct size
val encrypt : Cstruct.t -> t -> Cstruct.t
encrypt input state
isoutput
, the ChaCha encryption function.
val decrypt : Cstruct.t -> t -> Cstruct.t
encrypt input state
isoutput
, the ChaCha decryption function.