commit | 973b86940f9eca7410581d66229477f198ef2248 | [log] [tgz] |
---|---|---|
author | Treehugger Robot <treehugger-gerrit@google.com> | Wed Jun 15 20:10:27 2022 +0000 |
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | Wed Jun 15 20:10:27 2022 +0000 |
tree | d6a752d87ff82d0e66cde9223d2dce69de976863 | |
parent | 0d9b9d74372fb35b00d8909f6708205686b78b31 [diff] | |
parent | d62df03b14df461e22ed1de108f38881dedbf054 [diff] |
Merge "Update TEST_MAPPING" am: d62df03b14 Original change: https://android-review.googlesource.com/c/platform/external/rust/crates/getrandom/+/2125908 Change-Id: Icc46a6df04389ad7bc114dfb74032e3de72ab88b Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
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.