package ttweetnacl

  1. Overview
  2. Docs

Nonces.

Use Nonce.generate to generate one.

type t

The type for nonces.

val length : int

length is the byte length of nonces.

val generate : unit -> t

generate () generates a random nonce using Entropy.gather. The function blocks until enough entropy is gathered.

val equal : t -> t -> bool

equal n n' determines in constant time if n and n' are bytewise equal.

val of_bytes : Bytes.t -> t

of_bytes b is a nonce from bytes b. Raises Invalid_argument if n's length differs from length.

val to_bytes : t -> Bytes.t

to_bytes n are the bytes of n.

val pp : Stdlib.Format.formatter -> t -> unit

pp ppf n is an unspecified formatter for nonces.