feat: updat eaegis test

This commit is contained in:
2023-08-19 23:34:41 +08:00
parent a321aae4d2
commit 45eb023741
4 changed files with 75 additions and 1 deletions

View File

@@ -5,6 +5,7 @@ use aes_gcm::{
};
use benchmark_simple::*;
use chacha20poly1305::ChaCha20Poly1305;
use rocca::Rocca;
fn test_aes256gcm(m: &mut [u8]) {
let key = aes_gcm::Key::<Aes256Gcm>::from_slice(&[0u8; 32]);
@@ -43,12 +44,19 @@ fn test_aegis128l(m: &mut [u8]) {
state.encrypt_in_place(m, &[]);
}
fn test_rocca(m: &mut [u8]) {
let key = [0u8; 32];
let nonce = [0u8; 16];
let state = Rocca::new(&nonce, &key);
state.encrypt_in_place(m, &[]);
}
fn main() {
let bench = Bench::new();
let mut m = vec![0xd0u8; 16384];
let options = &Options {
iterations: 10_000, // 100_000 > 10_000
iterations: 10_000, // 100_000 -> 10_000 -> 1_000
warmup_iterations: 1_000,
min_samples: 5,
max_samples: 10,
@@ -70,4 +78,7 @@ fn main() {
let res = bench.run(options, || test_ascon128a(&mut m));
println!("ascon128a : {}", res.throughput(m.len() as _));
let res = bench.run(options, || test_rocca(&mut m));
println!("rocca : {}", res.throughput(m.len() as _));
}