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_auth : auth -> storage

of_auth a converts a to storage. The result is auth_size bytes long.

val to_auth : storage -> auth

to_auth s converts s to an authenticator.

  • raises Size_mismatch

    if s is not auth_size bytes long

val auth : secret key -> storage -> auth

auth k m authenticates a message m using a secret key k, and returns an authenticator a.

val verify : secret key -> auth -> storage -> unit

verify k a m checks that a is a correct authenticator of a message m under the secret key k.

  • raises Verification_failure

    if a is not a correct authenticator of m under k