package mirage-crypto-rng-miou-unix

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type

Pfortuna, a domain-safe CSPRNG proposed by Schneier.

type g

State type for this generator.

val block : int

Internally, this generator's generate always produces k * block bytes.

val create : ?time:(unit -> int64) -> unit -> g

Create a new, unseeded g.

val generate_into : g:g -> bytes -> off:int -> int -> unit

generate_into ~g buf ~off n produces n uniformly distributed random bytes into buf at offset off, updating the state of g.

  • raises Invalid_argument

    if buffer is too small (it must be: Bytes.length buf - off >= n)

val reseed : g:g -> string -> unit

reseed ~g bytes directly updates g. Its new state depends both on bytes and the previous state.

A generator is seded after a single application of reseed.

val accumulate : g:g -> Mirage_crypto_rng.Entropy.source -> [ `Acc of string -> unit ]

accumulate ~g is a closure suitable for incrementally feeding small amounts of environmentally sourced entropy into g.

Its operation should be fast enough for repeated calling from e.g. event loops. Systems with several distinct, stable entropy sources should use stable source to distinguish their sources.

val seeded : g:g -> bool

seeded ~g is true iff operations won't throw Unseeded_generator.

val pools : int

pools is the amount of pools if any.

OCaml

Innovation. Community. Security.