tag | 75a54f39c5f2e19a8a2c8bcf2f617d43a96efd9c | |
---|---|---|
tagger | The Android Open Source Project <initial-contribution@android.com> | Fri Sep 17 01:19:54 2021 -0700 |
object | 33892a6159b5dc212538a7a960085aa5965fc2bb |
Platform Tools Release 31.0.3 (7562133)
commit | 33892a6159b5dc212538a7a960085aa5965fc2bb | [log] [tgz] |
---|---|---|
author | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | Thu Jul 08 01:04:18 2021 +0000 |
committer | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | Thu Jul 08 01:04:18 2021 +0000 |
tree | 80f678aead2e8020cabb49c9e783297bd49560da | |
parent | c0a8cdbb0f170d219ed1e42413d0a9a0e99aa8f3 [diff] | |
parent | 97c556068a585dc8e691e0f9b714bc6fcff0c57b [diff] |
Snap for 7529902 from 97c556068a585dc8e691e0f9b714bc6fcff0c57b to sdk-release Change-Id: Ib03341240ec9dbf5e93b27e93db5001535e33b7b
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.