#aes-256 #drbg #ctr #drbg-ctx

aes_ctr_drbg

Implementation of CTR DRBG based on AES-256

2 releases

0.0.2 Apr 13, 2021
0.0.1 Apr 13, 2021

#2 in #ctr

Download history 65/week @ 2024-03-13 85/week @ 2024-03-20 198/week @ 2024-03-27 181/week @ 2024-04-03 29/week @ 2024-04-10 88/week @ 2024-04-17 67/week @ 2024-04-24 43/week @ 2024-05-01 84/week @ 2024-05-08 64/week @ 2024-05-15 76/week @ 2024-05-22 77/week @ 2024-05-29 61/week @ 2024-06-05 168/week @ 2024-06-12 53/week @ 2024-06-19 89/week @ 2024-06-26

395 downloads per month

MIT license

5KB
95 lines

AES-CTR-DRBG

DRBG implementation based on AES-256.

Usage:

use aes_ctr_drbg::DrbgCtx;

fn main() {


	// personalization string must be min. 48 bytes long
	let p = vec![48, 0];

	// get entropy from somewhere, f.e. /dev/random
	let entropy: [u8; 48] = [0x04; 48]; // don't use that!

	let mut drbg = DrbgCtx::new();
	drbg.init(&entropy, p);

	// get 10 bytes
	let mut out = Vec::new();
	out.resize(10, 0);
	drbg.get_random(&mut out);

    println!("{:?}", out);
}

Dependencies

~4MB
~51K SLoC