commit | aca7d7b4a0d1d4b04a2812ea87d83dcff0112553 | [log] [tgz] |
---|---|---|
author | Matthew Maurer <[email protected]> | Tue May 31 17:24:03 2022 +0000 |
committer | Automerger Merge Worker <[email protected]> | Tue May 31 17:24:03 2022 +0000 |
tree | f6b5416a0aa904b88c57c43cafb1ecd3517b86a6 | |
parent | 67ee42f84fb56bd3a9278b1062bc12f6639988ae [diff] | |
parent | d662c29db8396bfd08fbce7f9a85ec608baa2a9e [diff] |
Update TEST_MAPPING am: 7ad73caf28 am: 0d9b9d7437 am: d662c29db8 Original change: https://android-review.googlesource.com/c/platform/external/rust/crates/getrandom/+/2107321 Change-Id: I5a867ced1200afe2100ae76421ff67aca5980bb1 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.