package sodium

  1. Overview
  2. Docs
type storage
val of_hash : hash -> storage

of_hash h converts h to storage. The result is size_of_hash h bytes long.

val to_hash : storage -> hash

to_hash s converts s to a hash.

  • raises Size_mismatch

    if s is greater than size_max or less than size_min bytes long

val of_key : secret key -> storage

of_key k converts key k to storage. The result is size_of_key k bytes long.

val to_key : storage -> secret key

to_key s converts s to a secret key.

val digest : ?size:int -> storage -> hash

digest ?size m computes a hash of size size (default size_default) for message m.

val digest_with_key : secret key -> ?size:int -> storage -> hash

digest_with_key key m computes a hash of size size (default size_default keyed by key for message m.

val update : state -> storage -> unit

update state m updates the state state with input m.

  • raises Already_finalized

    if state has already had final applied to it