commit | a94295d0de2322a15921f374bb853f40d69cda2a | [log] [tgz] |
---|---|---|
author | Karsten Tausche <karsten@fairphone.com> | Fri Jul 07 12:29:10 2023 +0200 |
committer | Karsten Tausche <karsten@fairphone.com> | Fri Jul 07 12:29:10 2023 +0200 |
tree | aea8128a071e1ea6d7b6ce26379865efb0862da9 | |
parent | a5722ead4d6b925a00cee4ecb66c0919a9864bad [diff] | |
parent | 439c1157b20cc07369c44ff046dcfce6c1e5adb0 [diff] |
Merge tag 'android-13.0.0_r52' into int/13/fp3 Android 13.0.0 Release 52 (TQ3A.230605.012) * tag 'android-13.0.0_r52': Change-Id: I2ec4941fec97a293c218c8518b3d52590fda0585
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.