Git Product home page Git Product logo

getrandom's Introduction

getrandom

Build Status Crate Documentation Dependency Status Downloads License

A Rust library for retrieving random data from (operating) system sources. It is assumed that the 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.

Usage

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.

Minimum Supported Rust Version

This crate requires Rust 1.36.0 or later.

License

The getrandom library is distributed under either of

at your option.

getrandom's People

Contributors

josephlr avatar newpavlov avatar dhardy avatar nipzu avatar tklauser avatar briansmith avatar sthibaul avatar zer0x64 avatar thomcc avatar pauan avatar flba-eb avatar sunfishcode avatar aaron1011 avatar mbrubeck avatar mjhanninen avatar kazhuu avatar nikarh avatar ecnelises avatar icewind1991 avatar sjmackenzie avatar syrusakbary avatar thomasdezeeuw avatar stoeckmann avatar kawadakk avatar evq avatar koushiro avatar kpcyrd avatar alarixnia avatar thorhs avatar autumnontape avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.