#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

#3 in #drbg

Download history 94/week @ 2024-07-22 48/week @ 2024-07-29 108/week @ 2024-08-05 7/week @ 2024-08-19 195/week @ 2024-08-26 104/week @ 2024-09-02 37/week @ 2024-09-09 9/week @ 2024-09-16 209/week @ 2024-09-23 53/week @ 2024-09-30 82/week @ 2024-10-07 55/week @ 2024-10-14 64/week @ 2024-10-21 179/week @ 2024-10-28 87/week @ 2024-11-04

412 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