use criterion::{black_box, criterion_group, criterion_main, Criterion}; use signature::{Keypair, Signer, Verifier}; use slh_dsa::*; pub fn sign_benchmark(c: &mut Criterion) { let mut rng = rand::thread_rng(); let sk = SigningKey::

::new(&mut rng); c.bench_function(&format!("sign: {}", P::NAME), |b| { b.iter(|| { let msg = b"Hello, world!"; let sig = sk.try_sign(msg).unwrap(); black_box(sig) }) }); } pub fn verify_benchmark(c: &mut Criterion) { let mut rng = rand::thread_rng(); let sk = SigningKey::

::new(&mut rng); let msg = b"Hello, world!"; let sig = sk.try_sign(msg).unwrap(); let vk = sk.verifying_key(); c.bench_function(&format!("verify: {}", P::NAME), |b| { b.iter(|| { let ok = vk.verify(msg, &sig); black_box(ok) }) }); } criterion_group!(name = sign_benches; config = Criterion::default().sample_size(10); targets = sign_benchmark, sign_benchmark, sign_benchmark, sign_benchmark, sign_benchmark, sign_benchmark, sign_benchmark, sign_benchmark, sign_benchmark, sign_benchmark, sign_benchmark, sign_benchmark, ); criterion_group!(name = verify_benches; config = Criterion::default().sample_size(10); targets = sign_benchmark, sign_benchmark, sign_benchmark, sign_benchmark, sign_benchmark, sign_benchmark, sign_benchmark, sign_benchmark, sign_benchmark, sign_benchmark, sign_benchmark, sign_benchmark, ); criterion_main!(sign_benches, verify_benches);