commit | e3246cd463d30499a727ab9de248e6000f3cf3eb | [log] [tgz] |
---|---|---|
author | Andrew Scull <[email protected]> | Fri Jul 29 19:22:33 2022 +0000 |
committer | Automerger Merge Worker <[email protected]> | Fri Jul 29 19:22:33 2022 +0000 |
tree | 7ca8a52775a815af5c02e5f1c23444c10e109e81 | |
parent | 9fe1794166b2d7a0bad8d5484d2f276d1987d373 [diff] | |
parent | 358f439dd1bec41816a6b566e49fee21435c06e5 [diff] |
Make available to all APEXs am: 0a2860d847 am: 02d96e9f3b am: c157bf4c2f am: 358f439dd1 Original change: https://android-review.googlesource.com/c/platform/external/rust/crates/getrandom/+/2169803 Change-Id: Icd0b7ef71b7235fc43822b5c32f6be249997457a Signed-off-by: Automerger Merge Worker <[email protected]>
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.