package mirage-crypto-rng

  1. Overview
  2. Docs
A cryptographically secure PRNG

Install

dune-project
 Dependency

Authors

Maintainers

Sources

mirage-crypto-2.2.0.tbz
sha256=4b87091b6a77843bf97a74aae2e7da21310307ff7d2105712c4369680122d80a
sha512=3361649703d0e391e5adc40770dcb4dcbee2ecd27a64962e28c7f8240a67131efe9226a5240ac7a019c1464f217abec9c71dbb8412ef2b4eafeb4ad8e3931805

doc/mirage-crypto-rng.unix/Mirage_crypto_rng_unix/Urandom/index.html

Module Mirage_crypto_rng_unix.UrandomSource

A generator that opens /dev/urandom and reads from that file descriptor data whenever random data is needed. The file descriptor is closed in at_exit.

Sourcetype g

State type for this generator.

Sourceval block : int

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

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

Create a new, unseeded g.

Sourceval 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.

Assumes that buf is at least off + n bytes long. Also assumes that off and n are positive integers. Caution: do not use in your application, use Mirage_crypto_rng.generate_into instead.

  • alert unsafe Does not do bounds checks. Use Mirage_crypto_rng.generate_into instead.
Sourceval 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.

Sourceval 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.

Sourceval seeded : g:g -> bool

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

Sourceval pools : int

pools is the amount of pools if any.