commit | 28f27ef1ac199a65d77fefa3f7f9d83c7cd238df | [log] [tgz] |
---|---|---|
author | Android Build Coastguard Worker <[email protected]> | Wed Jun 15 21:44:07 2022 +0000 |
committer | Android Build Coastguard Worker <[email protected]> | Wed Jun 15 21:44:07 2022 +0000 |
tree | 78413dcf697346c0e15e4615d70bce99e4175794 | |
parent | 8d2ea43a57360a9d54308fe21f27dd2c38a6f5b4 [diff] | |
parent | fba8cea794b3daf57fa3182b73eb1ab13786fcdf [diff] |
Snap for 8730993 from fba8cea794b3daf57fa3182b73eb1ab13786fcdf to mainline-tzdata3-release Change-Id: Ib3dec89365acb259476d2ca7585ffc11fd9e8695
A Rust library for retrieving random data from (operating) system source. It is assumed that system always provides high-quality cryptographically secure random data, ideally backed by hardware entropy sources. This crate derives its name from Linux‘s getrandom
function, but is cross platform, roughly supporting the same set of platforms as Rust’s std
lib.
This is a low-level API. Most users should prefer using high-level random-number library like rand
.
Add this to your Cargo.toml
:
[dependencies] getrandom = "0.2"
Then invoke the getrandom
function:
fn get_random_buf() -> Result<[u8; 32], getrandom::Error> { let mut buf = [0u8; 32]; getrandom::getrandom(&mut buf)?; Ok(buf) }
For more information about supported targets, entropy sources, no_std
targets, crate features, WASM support and Custom RNGs see the getrandom
documentation and getrandom::Error
documentation.
This crate requires Rust 1.34.0 or later.
The getrandom
library is distributed under either of
at your option.