package mirage-crypto-rng

  1. Overview
  2. Docs
A cryptographically secure PRNG

Install

dune-project
 Dependency

Authors

Maintainers

Sources

mirage-crypto-2.0.3.tbz
sha256=3919a8bda3635959bb662d4ffa32266eb73c450ecc2a2b66ba5e1ecf88f7ad23
sha512=0580c8787cac821531c6038b9f82d32f6a7d3beee0b4c6900c2bf9fa3fa1b2a8d460b4d53ade8cd03e5e8e968b85f2c870c17818ad6e0f12d6834da92db4bef8

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

Module Mirage_crypto_rng_unixSource

RNG seeding on Unix.

This module initializes a Fortuna RNG with getrandom(), and CPU RNG. On BSD systems (FreeBSD, OpenBSD, macOS) getentropy () is used instead of getrandom (). On Windows 10 or higher, BCryptGenRandom() is used with the default RNG. Windows 8 or lower are not supported by this library.

Sourceval initialize : ?g:'a -> 'a Mirage_crypto_rng.generator -> unit

initialize ~g rng will bring the RNG into a working state.

  • deprecated Use 'Mirage_crypto_rng_unix.use_default ()' instead.
Sourceval getrandom : int -> string

getrandom size returns a buffer of size filled with random bytes.

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.

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

Sourceval use_default : unit -> unit

use_default () initializes the RNG Mirage_crypto_rng.default_generator with a sensible default, at the moment using Getentropy.

Sourceval use_dev_urandom : unit -> unit

use_dev_random () initializes the RNG Mirage_crypto_rng.default_generator with the Urandom generator. This raises an exception if "/dev/urandom" cannot be opened.

Sourceval use_getentropy : unit -> unit

use_getentropy () initializes the RNG Mirage_crypto_rng.default_generator with the Getentropy generator.