#random #esdm

rand-esdm

provides interface to ESDM RNG server

14 releases

Uses new Rust 2024

0.2.2 Apr 11, 2025
0.1.5 Jul 23, 2024
0.1.1 Mar 22, 2024
0.0.2 Aug 10, 2023

#687 in Cryptography

Download history 2/week @ 2024-12-30 32/week @ 2025-01-06 71/week @ 2025-01-13 85/week @ 2025-01-20 61/week @ 2025-01-27 39/week @ 2025-02-03 63/week @ 2025-02-10 34/week @ 2025-02-17 72/week @ 2025-02-24 39/week @ 2025-03-03 89/week @ 2025-03-10 28/week @ 2025-03-17 57/week @ 2025-03-24 49/week @ 2025-03-31 430/week @ 2025-04-07 104/week @ 2025-04-14

640 downloads per month
Used in esdm-tool

MIT license

22KB
434 lines

rand-esdm

crates.io

About

A small library for interfacing Rust with the ESDM user-space random server.

It currently provides the minimal amount of bindings necessary to use ESDM together with the rand crate.

Usage Example

Add rand-esdm to your Cargo.toml

rand-esdm = "0.2.1"

Generate Random Numbers with rand crate

Choose type of rng:

  • Only usable when fully seeded: let mut rng = EsdmRng::new(EsdmRngType::FullySeeded);
  • Only usable with fresh entropy: let mut rng = EsdmRng::new(EsdmRngType::PredictionResistant);

Include Rng utility trait from rand:

use rand::Rng;

Draw random numbers as needed, e.g.:

let rnd: u64 = rng.random();

Complete toy example can be found in examples/readme.rs:

use rand::{Rng, TryRngCore};
use rand_esdm::{EsdmRng, EsdmRngType};

fn main() {
    let mut rng = EsdmRng::new(EsdmRngType::FullySeeded).unwrap_err();
    let rnd: u32 = rng.random();
    println!("{rnd:X}");
}

Dependencies

~2.3–5MB
~94K SLoC