#random #nist #pqc #seedable-rng #competition #testing

no-std nist-pqc-seeded-rng

Implementation of the RNG used to produce the KATs in NIST PQC competition

8 releases

Uses new Rust 2024

new 0.3.1 Apr 15, 2025
0.3.0 Jan 29, 2025
0.2.1 Apr 15, 2025
0.2.0 Sep 13, 2024
0.1.2 Jul 16, 2024

#1011 in Cryptography

Download history 7/week @ 2024-12-24 128/week @ 2025-01-28 5/week @ 2025-02-04 30/week @ 2025-02-11

462 downloads per month
Used in faest

Apache-2.0 OR MIT

13KB
217 lines

Usage

The RNG can be instantiated from a 48 byte seed using various options: first with SeedableRng::from_seed as defined in the interface of seedable API. To avoid the user to handle the conversion to [GenericArray] which is used to represent a seed, convenience implementations of [From] for a u8 array with 48 elements as well as [TryFrom] for a [u8] slice is provided.

The following three examples are functionally equivalent. Let us start with initializing from [Seed]:

use nist_pqc_seeded_rng::{NistPqcAes256CtrRng, Seed, SeedableRng};

let seed: Seed = (*b"012345678901234567890123456789012345678901234567").into();
let rng = NistPqcAes256CtrRng::from_seed(seed);

Using a u8 array:

use nist_pqc_seeded_rng::{NistPqcAes256CtrRng, Seed, SeedableRng};

let seed: [u8; 48] = *b"012345678901234567890123456789012345678901234567";
let rng = NistPqcAes256CtrRng::from(seed);

Using a slice:

use nist_pqc_seeded_rng::{NistPqcAes256CtrRng, Seed, SeedableRng};

let seed = b"012345678901234567890123456789012345678901234567".as_slice();
let rng = NistPqcAes256CtrRng::try_from(seed).expect("seed of invalid length");

NIST PQC: RNG for known answer tests

This crate provides a seedable RNG that produces outputs compatible with rng.c used by submissions to the NIST PQC project to obtain known answer tests from an initial seed.

Security Notes

This crate has received no security audit. Use at your own risk.

Minimum Supported Rust Version

This crate requires Rust 1.70 at a minimum. The MSRV may be changed in the future, but this change will be accompanied by a minor version bump.

License

This crate is licensed under the Apache-2.0 or MIT license.

Dependencies

~1.1–1.9MB
~43K SLoC