use criterion::{black_box, criterion_group, criterion_main, Criterion}; use easy_aes::{full_decrypt, full_encrypt, Keys, BLOCK}; fn criterion_full_test(c: &mut Criterion) { let mut message = BLOCK::new([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]); let key = Keys::from(BLOCK::new([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, ])); c.bench_function("encrypt preset block", |b| { b.iter(|| { full_encrypt(black_box(&mut message), black_box(&key)); }) }); c.bench_function("decrypt preset block", |d| { d.iter(|| { full_decrypt(black_box(&mut message), black_box(&key)); }) }); } criterion_group!(benches, criterion_full_test); criterion_main!(benches);