package ttweetnacl

  1. Overview
  2. Docs

Secret keys.

Use Secret_key.generate to generate one.

type t

The type for secret keys.

val length : int

length is the byte length of secret keys.

val generate : unit -> t

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

val equal : t -> t -> bool

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

val of_bytes : Bytes.t -> t

of_bytes b is a secret key from bytes b. Raises Invalid_argument if b's length differs from length.

val to_bytes : t -> Bytes.t

to_bytes k are the bytes of k.

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

pp ppf pk is an unspecified formatter for secret keys.

OCaml

Innovation. Community. Security.