package sodium

  1. Overview
  2. Docs
type storage = Stdlib.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.

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.

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

secret_box k m n encrypts and authenticates a message m using a secret key k and a nonce n, and returns the resulting ciphertext.

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

secret_box_open k c n verifies and decrypts a ciphertext c using a secret key k and a nonce n, and returns the resulting plaintext m.

OCaml

Innovation. Community. Security.