diff options
Diffstat (limited to 'benches/spake2.rs')
-rw-r--r-- | benches/spake2.rs | 41 |
1 files changed, 29 insertions, 12 deletions
diff --git a/benches/spake2.rs b/benches/spake2.rs index d945d5a..8323342 100644 --- a/benches/spake2.rs +++ b/benches/spake2.rs @@ -4,32 +4,49 @@ extern crate bencher; extern crate spake2; use bencher::Bencher; -use spake2::{Ed25519Group, SPAKE2}; +use spake2::{Ed25519Group, Identity, Password, SPAKE2}; fn spake2_start(bench: &mut Bencher) { bench.iter(|| { - let (_, _) = SPAKE2::<Ed25519Group>::start_a(b"password", b"A", b"B"); + let (_, _) = SPAKE2::<Ed25519Group>::start_a( + &Password::new(b"password"), + &Identity::new(b"idA"), + &Identity::new(b"idB"), + ); }) } /* fn spake2_finish(bench: &mut Bencher) { // this doesn't work, because s1 is consumed by doing finish() - let (s1, msg1) = SPAKE2::<Ed25519Group>::start_a(b"password", - b"idA", b"idB"); - let (s2, msg2) = SPAKE2::<Ed25519Group>::start_b(b"password", - b"idA", b"idB"); + let (s1, msg1) = SPAKE2::<Ed25519Group>::start_a( + &Password::new(b"password"), + &Identity::new(b"idA"), + &Identity::new(b"idB"), + ); + let (s2, msg2) = SPAKE2::<Ed25519Group>::start_b( + &Password::new(b"password"), + &Identity::new(b"idA"), + &Identity::new(b"idB"), + ); let msg2_slice = msg2.as_slice(); - bench.iter(|| { - s1.finish(msg2_slice) - }) -}*/ + bench.iter(|| s1.finish(msg2_slice)) +} +*/ fn spake2_start_and_finish(bench: &mut Bencher) { - let (_, msg2) = SPAKE2::<Ed25519Group>::start_b(b"password", b"idA", b"idB"); + let (_, msg2) = SPAKE2::<Ed25519Group>::start_b( + &Password::new(b"password"), + &Identity::new(b"idA"), + &Identity::new(b"idB"), + ); let msg2_slice = msg2.as_slice(); bench.iter(|| { - let (s1, _) = SPAKE2::<Ed25519Group>::start_a(b"password", b"idA", b"idB"); + let (s1, _) = SPAKE2::<Ed25519Group>::start_a( + &Password::new(b"password"), + &Identity::new(b"idA"), + &Identity::new(b"idB"), + ); s1.finish(msg2_slice) }) } |