package mirage-crypto-rng
A cryptographically secure PRNG
Install
Dune Dependency
Authors
Maintainers
Sources
mirage-crypto-0.11.2.tbz
sha256=d6b97cb7f0dc344a602513cc03137c1e7f0ae105d0721614626cf4f231edf764
sha512=7ab8824730d09bfb4c82a290860e96c8a722456084806741c773ab8d30c983d2061a3f79484debf5fa9bd1c75a0738bd8913b0539743e61245ad172844572b9e
doc/src/mirage-crypto-rng.unix/mirage_crypto_rng_unix.ml.html
Source file mirage_crypto_rng_unix.ml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
open Mirage_crypto_rng let src = Logs.Src.create "mirage-crypto-rng.unix" ~doc:"Mirage crypto RNG Unix" module Log = (val Logs.src_log src : Logs.LOG) open Stdlib.Bigarray type buffer = (char, int8_unsigned_elt, c_layout) Array1.t external getrandom_buf : buffer -> int -> unit = "mc_getrandom" let getrandom size = let buf = Cstruct.create_unsafe size in getrandom_buf buf.Cstruct.buffer size; buf let getrandom_init i = let data = getrandom 128 in Entropy.header i data let running = ref false let initialize (type a) ?g (rng : a generator) = if !running then Log.debug (fun m -> m "Mirage_crypto_rng_unix.initialize has already been called, \ ignoring this call.") else begin (try let _ = default_generator () in Log.warn (fun m -> m "Mirage_crypto_rng.default_generator has already \ been set, check that this call is intentional"); with No_default_generator -> ()); running := true ; let seed = let init = Entropy.[ bootstrap ; whirlwind_bootstrap ; bootstrap ; getrandom_init ] in List.mapi (fun i f -> f i) init |> Cstruct.concat in let _ = Entropy.register_source "getrandom" in set_default_generator (create ?g ~seed rng) end
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>