| commit | 660b69c8ebae4b87865636d0dca3603e8c7e6dce | [log] [tgz] |
|---|---|---|
| author | Android Build Coastguard Worker <[email protected]> | Thu Feb 02 02:27:31 2023 +0000 |
| committer | Android Build Coastguard Worker <[email protected]> | Thu Feb 02 02:27:31 2023 +0000 |
| tree | b8f94bacd79df2b4360c070d2a702aee5abcb2a8 | |
| parent | 2c94b69683b3e764154b758655db3f8ab60baadd [diff] | |
| parent | bdac4a815f73b1ad467587fe3871dd00d645dc3a [diff] |
Snap for 9552483 from bdac4a815f73b1ad467587fe3871dd00d645dc3a to udc-release Change-Id: I0689b0ce831e826aac54e73169a5957ed6eb89e2
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.