package mirage-crypto-rng

  1. Overview
  2. Docs
A cryptographically secure PRNG

Install

dune-project
 Dependency

Authors

Maintainers

Sources

mirage-crypto-2.4.1.tbz
sha256=332886c365c6035077e3ce676a63da8f7500c15a1628b3c07e139b0e551f1f6f
sha512=cb8f4de93241cde0582bcd0283766c681a02dbcb9f3b4786eb0656c651f42ba2db467ff63bff79c5eacfd410e410d77dc31bfc51049c39e1e86685ec0a884c1f

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

Module Mirage_crypto_rng_unix.GetentropySource

A generator using getrandom(3) on Linux, getentropy(3) on BSD and macOS, and BCryptGenRandom() on Windows.

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.