Name |
Date |
Size |
#Lines |
LOC |
||
---|---|---|---|---|---|---|
.. | - | - | ||||
benches/ | 25-Apr-2025 | - | 72 | 43 | ||
src/ | 25-Apr-2025 | - | 1,775 | 1,044 | ||
tests/ | 25-Apr-2025 | - | 191 | 136 | ||
.cargo-checksum.json | D | 25-Apr-2025 | 3.3 KiB | 1 | 1 | |
Android.bp | D | 25-Apr-2025 | 2.2 KiB | 99 | 92 | |
CHANGELOG.md | D | 25-Apr-2025 | 17 KiB | 453 | 363 | |
Cargo.toml | D | 25-Apr-2025 | 2.4 KiB | 95 | 82 | |
LICENSE | D | 25-Apr-2025 | 10.6 KiB | 202 | 169 | |
LICENSE-APACHE | D | 25-Apr-2025 | 10.6 KiB | 202 | 169 | |
LICENSE-MIT | D | 25-Apr-2025 | 1.1 KiB | 27 | 23 | |
METADATA | D | 25-Apr-2025 | 422 | 18 | 17 | |
MODULE_LICENSE_APACHE2 | D | 25-Apr-2025 | 0 | |||
README.md | D | 25-Apr-2025 | 3.1 KiB | 82 | 57 | |
SECURITY.md | D | 25-Apr-2025 | 694 | 14 | 7 | |
TEST_MAPPING | D | 25-Apr-2025 | 2.6 KiB | 120 | 119 | |
cargo_embargo.json | D | 25-Apr-2025 | 157 | 13 | 12 |
README.md
1# getrandom 2 3[![Build Status]][GitHub Actions] [![Crate]][crates.io] [![Documentation]][docs.rs] [![Dependency Status]][deps.rs] [![Downloads]][crates.io] [![License]][LICENSE-MIT] 4 5[GitHub Actions]: https://github.com/rust-random/getrandom/actions?query=workflow:Tests+branch:master 6[Build Status]: https://github.com/rust-random/getrandom/actions/workflows/tests.yml/badge.svg?branch=master 7[crates.io]: https://crates.io/crates/getrandom 8[Crate]: https://img.shields.io/crates/v/getrandom 9[docs.rs]: https://docs.rs/getrandom 10[Documentation]: https://docs.rs/getrandom/badge.svg 11[deps.rs]: https://deps.rs/repo/github/rust-random/getrandom 12[Dependency Status]: https://deps.rs/repo/github/rust-random/getrandom/status.svg 13[Downloads]: https://img.shields.io/crates/d/getrandom 14[LICENSE-MIT]: https://raw.githubusercontent.com/rust-random/getrandom/master/LICENSE-MIT 15[License]: https://img.shields.io/crates/l/getrandom 16 17 18A Rust library for retrieving random data from (operating) system sources. It is 19assumed that the system always provides high-quality cryptographically secure random 20data, ideally backed by hardware entropy sources. This crate derives its name 21from Linux's `getrandom` function, but is cross-platform, roughly supporting 22the same set of platforms as Rust's `std` lib. 23 24This is a low-level API. Most users should prefer using high-level random-number 25library like [`rand`]. 26 27[`rand`]: https://crates.io/crates/rand 28 29## Usage 30 31Add this to your `Cargo.toml`: 32 33```toml 34[dependencies] 35getrandom = "0.2" 36``` 37 38Then invoke the `getrandom` function: 39 40```rust 41fn get_random_buf() -> Result<[u8; 32], getrandom::Error> { 42 let mut buf = [0u8; 32]; 43 getrandom::getrandom(&mut buf)?; 44 Ok(buf) 45} 46``` 47 48For more information about supported targets, entropy sources, `no_std` targets, 49crate features, WASM support and Custom RNGs see the 50[`getrandom` documentation](https://docs.rs/getrandom/latest) and 51[`getrandom::Error` documentation](https://docs.rs/getrandom/latest/getrandom/struct.Error.html). 52 53## Minimum Supported Rust Version 54 55This crate requires Rust 1.36.0 or later. 56 57## Platform Support 58 59This crate generally supports the same operating system and platform versions that the Rust standard library does. 60Additional targets may be supported using pluggable custom implementations. 61 62This means that as Rust drops support for old versions of operating systems (such as old Linux kernel versions, Android API levels, etc) 63in stable releases, `getrandom` may create new patch releases (`0.N.x`) that remove support for outdated platform versions. 64 65## License 66 67The `getrandom` library is distributed under either of 68 69 * [Apache License, Version 2.0][LICENSE-APACHE] 70 * [MIT license][LICENSE-MIT] 71 72at your option. 73 74### Contribution 75 76Unless you explicitly state otherwise, any contribution intentionally submitted 77for inclusion in the work by you, as defined in the Apache-2.0 license, shall be 78dual licensed as above, without any additional terms or conditions. 79 80[LICENSE-APACHE]: https://github.com/rust-random/getrandom/blob/master/LICENSE-APACHE 81[LICENSE-MIT]: https://github.com/rust-random/getrandom/blob/master/LICENSE-MIT 82