package sodium

  1. Overview
  2. Docs
type storage = Bytes.t
val of_key : secret key -> storage

of_key k converts k to storage. The result is key_size bytes long.

val to_key : storage -> secret key

to_key s converts s to a secret key.

  • raises Size_mismatch

    if s is not key_size bytes long

val of_nonce : nonce -> storage

of_nonce n converts n to storage. The result is nonce_size bytes long.

val to_nonce : storage -> nonce

to_nonce s converts s to a nonce.

  • raises Size_mismatch

    if s is not nonce_size bytes long

val stream : secret key -> int -> nonce -> storage

stream k len n produces a len-byte stream c as a function of a secret key k and a nonce n.

val stream_xor : secret key -> storage -> nonce -> storage

stream_xor k m n encrypts or decrypts a message m using a secret key k and a nonce n.