Name | Date | Size | #Lines | LOC | ||
---|---|---|---|---|---|---|
.. | 15-Mar-2021 | - | ||||
benches/ | H | 15-Mar-2021 | - | 25 | 21 | |
src/ | H | 15-Mar-2021 | - | 1,224 | 744 | |
tests/ | H | 15-Mar-2021 | - | 62 | 45 | |
.cargo-checksum.json | H A D | 15-Mar-2021 | 2.1 KiB | 1 | 1 | |
CHANGELOG.md | H A D | 15-Mar-2021 | 652 | 23 | 15 | |
Cargo.toml | H A D | 15-Mar-2021 | 1.6 KiB | 53 | 48 | |
LICENSE-APACHE | H A D | 15-Mar-2021 | 10.6 KiB | 202 | 169 | |
LICENSE-MIT | H A D | 15-Mar-2021 | 1.1 KiB | 27 | 23 | |
README.md | H A D | 15-Mar-2021 | 2 KiB | 68 | 43 |
README.md
1# getrandom 2 3[![Build Status](https://travis-ci.org/rust-random/getrandom.svg?branch=master)](https://travis-ci.org/rust-random/getrandom) 4[![Build Status](https://ci.appveyor.com/api/projects/status/github/rust-random/getrandom?svg=true)](https://ci.appveyor.com/project/rust-random/getrandom) 5[![Crate](https://img.shields.io/crates/v/getrandom.svg)](https://crates.io/crates/getrandom) 6[![Documentation](https://docs.rs/getrandom/badge.svg)](https://docs.rs/getrandom) 7[![Dependency status](https://deps.rs/repo/github/rust-random/getrandom/status.svg)](https://deps.rs/repo/github/rust-random/getrandom) 8 9 10A Rust library for retrieving random data from (operating) system source. It is 11assumed that system always provides high-quality cryptographically secure random 12data, ideally backed by hardware entropy sources. This crate derives its name 13from Linux's `getrandom` function, but is cross platform, roughly supporting 14the same set of platforms as Rust's `std` lib. 15 16This is a low-level API. Most users should prefer using high-level random-number 17library like [`rand`]. 18 19[`rand`]: https://crates.io/crates/rand 20 21 22## Usage 23 24Add this to your `Cargo.toml`: 25 26```toml 27[dependencies] 28getrandom = "0.1" 29``` 30 31Then invoke the `getrandom` function: 32 33```rust 34fn get_random_buf() -> Result<[u8; 32], getrandom::Error> { 35 let mut buf = [0u8; 32]; 36 getrandom::getrandom(&mut buf)?; 37 buf 38} 39``` 40 41## Features 42 43This library is `no_std` compatible, but uses `std` on most platforms. 44 45The `log` library is supported as an optional dependency. If enabled, error 46reporting will be improved on some platforms. 47 48For WebAssembly (`wasm32`), WASI and Emscripten targets are supported directly; otherwise 49one of the following features must be enabled: 50 51- [`wasm-bindgen`](https://crates.io/crates/wasm_bindgen) 52- [`stdweb`](https://crates.io/crates/stdweb) 53 54## Minimum Supported Rust Version 55 56This crate requires Rust 1.32.0 or later. 57 58 59# License 60 61The `getrandom` library is distributed under either of 62 63 * [Apache License, Version 2.0](LICENSE-APACHE) 64 * [MIT license](LICENSE-MIT) 65 66at your option. 67 68