vitaminc-random

Crates.iovitaminc-random
lib.rsvitaminc-random
version0.1.0-pre2
sourcesrc
created_at2024-09-17 01:38:52.068898
updated_at2024-09-17 04:18:39.546893
descriptionSecure Random Number Generation. Part of the Vitamin-C cryptographic suite.
homepagehttps://cipherstash.com
repositoryhttps://github.com/cipherstash/vitaminc
max_upload_size
id1377068
size12,845
Dan Draper (coderdan)

documentation

https://docs.rs/vitaminc-random

README

Vitamin C Random

Crates.io Workflow Status

A carefully designed random number generator that is safe to use for cryptographic purposes.

This crate is part of the Vitamin C framework to make cryptography code healthy.

Bounded Random Numbers

The BoundedRng trait provides a way to generate random numbers within a specific range.

use vitaminc_random::{BoundedRng, SafeRand, SeedableRng};

let mut rng = SafeRand::from_entropy();
let value: u32 = rng.next_bounded(10);
assert!(value <= 10);

Or using a Protected value:

use vitaminc_protected::{Controlled, Protected};
use vitaminc_random::{BoundedRng, SafeRand, SeedableRng};

let mut rng = SafeRand::from_entropy();
let value: Protected<u32> = rng.next_bounded(Protected::new(10));
assert!(value.risky_unwrap() <= 10);

CipherStash

Vitamin C is brought to you by the team at CipherStash.

License: MIT

Commit count: 0

cargo fmt