commit | 543a23281e2fc866a91c2bedec4a887df66fcf29 | [log] [tgz] |
---|---|---|
author | Andrew Scull <[email protected]> | Fri Jul 29 19:38:48 2022 +0000 |
committer | Automerger Merge Worker <[email protected]> | Fri Jul 29 19:38:48 2022 +0000 |
tree | 7ca8a52775a815af5c02e5f1c23444c10e109e81 | |
parent | 3c6948f4da1eef1e9ae025feefd06fa575a54bd8 [diff] | |
parent | e3246cd463d30499a727ab9de248e6000f3cf3eb [diff] |
Make available to all APEXs am: 0a2860d847 am: 02d96e9f3b am: c157bf4c2f am: 358f439dd1 am: e3246cd463 Original change: https://android-review.googlesource.com/c/platform/external/rust/crates/getrandom/+/2169803 Change-Id: I170da9163366f06e34980c26cab91fc3299c3cd5 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.