#![feature(test)] extern crate test; use curve25519_dalek::scalar::Scalar; use pea_vrf::Proof; use rand_core::OsRng; use sha3::Sha3_224; use sha3::Sha3_256; use sha3::Sha3_512; use test::Bencher; #[bench] fn public(b: &mut Bencher) { let secret: Scalar = Scalar::random(&mut OsRng); b.iter(|| pea_vrf::compress_to_bytes(pea_vrf::ristretto_point(&secret))); } #[bench] fn prove(b: &mut Bencher) { let secret: Scalar = Scalar::random(&mut OsRng); let alpha = []; b.iter(|| Proof::new::(&secret, &alpha)); } #[bench] fn beta(b: &mut Bencher) { let secret: Scalar = Scalar::random(&mut OsRng); let alpha = []; let proof = Proof::new::(&secret, &alpha); b.iter(|| proof.hash::()); } #[bench] fn validate_key(b: &mut Bencher) { let secret: Scalar = Scalar::random(&mut OsRng); let public = pea_vrf::compress_to_bytes(pea_vrf::ristretto_point(&secret)); b.iter(|| pea_vrf::validate_key(&public)); } #[bench] fn verify(b: &mut Bencher) { let secret: Scalar = Scalar::random(&mut OsRng); let public = pea_vrf::compress_to_bytes(pea_vrf::ristretto_point(&secret)); let alpha = []; let proof = Proof::new::(&secret, &alpha); let beta = proof.hash::(); b.iter(|| proof.verify::(&public, &alpha, &beta)); }