package ttweetnacl

  1. Overview
  2. Docs

Module Box.NonceSource

Nonces.

Use Nonce.generate to generate one.

Sourcetype t

The type for nonces.

Sourceval length : int

length is the byte length of nonces.

Sourceval generate : unit -> t

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

Sourceval equal : t -> t -> bool

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

Sourceval of_bytes : Bytes.t -> t

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

Sourceval to_bytes : t -> Bytes.t

to_bytes n are the bytes of n.

Sourceval pp : Format.formatter -> t -> unit

pp ppf n is an unspecified formatter for nonces.