sponges/ascon/benches/bench.rs
Tony Arcieri ace9dd7723
ascon: expose permutation (#35)
Provides raw access to the Ascon permutation, allowing it to be used for
more things than just AEAD.
2023-02-11 12:12:58 -07:00

30 lines
646 B
Rust

#![feature(test)]
extern crate test;
use ascon::aead;
use test::Bencher;
#[bench]
fn ascon_encrypt_bench(b: &mut Bencher) {
let key = [4; 16];
let iv = [8; 16];
let aad = [3; 16];
let message = [99; 1025];
b.bytes = message.len() as u64;
b.iter(|| aead::encrypt(&key, &iv, &message, &aad));
}
#[bench]
fn ascon_decrypt_bench(b: &mut Bencher) {
let key = [4; 16];
let iv = [8; 16];
let aad = [3; 16];
let message = [99; 1025];
let (ciphertext, tag) = aead::encrypt(&key, &iv, &message, &aad);
b.bytes = message.len() as u64;
b.iter(|| aead::decrypt(&key, &iv, &ciphertext, &aad, &tag));
}