Crate crypto_api_osrandom

Source
Expand description

docs.rs License BSD-2-Clause License MIT crates.io Download numbers AppVeyor CI dependency status

§crypto_api_osrandom

Welcome to crypto_api_osrandom 🎉

§About

This crate implements access to your operating system’s cryptographically secure random number generator via crypto_api.

§APIs used

The following native APIs are used:

  • macOS/iOS: SecRandomCopyBytes from the security framework
  • FreeBSD/OpenBSD/NetBSD: arc4random_buf (which does not use ARC4 anymore but a secure PRF like ChaCha20)
  • Windows: CryptGenRandom with PROV_RSA_FULL as provider
  • Linux: getrandom for glibc versions >= 2.25 or /dev/urandom for ancient distributions

Modules§

error
Implements the crate’s error type

Functions§

to_array
Creates a LEN-sized array filled with crpytographically secure random bytes
to_slice
Fills the given slice with crpytographically secure random bytes
to_vec
Creates a len-sized vec filled with crpytographically secure random bytes