commit | ee34b5821180f923eb337be226e88821c97a33da | [log] [tgz] |
---|---|---|
author | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | Wed Feb 01 19:33:25 2023 +0000 |
committer | Android (Google) Code Review <android-gerrit@google.com> | Wed Feb 01 19:33:25 2023 +0000 |
tree | b8f94bacd79df2b4360c070d2a702aee5abcb2a8 | |
parent | 02845ed9fbef446102de0fd4f0cd52049599f8e3 [diff] | |
parent | f131fd3fc91514592861ab02b9e80fb214a79b2d [diff] |
Merge "Snap for 9551305 from bdac4a815f73b1ad467587fe3871dd00d645dc3a to mainline-tzdata5-release" into mainline-tzdata5-release
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.