aboutsummaryrefslogtreecommitdiff
path: root/spake2/benches/spake2.rs
diff options
context:
space:
mode:
authorBrian Warner <warner@lothar.com>2018-10-15 17:13:55 -0700
committerBrian Warner <warner@lothar.com>2018-10-15 17:19:56 -0700
commita23222c9c1cb604b62ccf133ff3f9ce0ca95bddf (patch)
tree2f0c6dc83ad2a53c684ad60dec69984ecff9ff5c /spake2/benches/spake2.rs
parent1afa40d15b0c2cecc989bdfc67a5251aa5cd5954 (diff)
parentf6e9d07dffa9a9b39f203c23043f93337ebe1ab6 (diff)
downloadPAKEs-a23222c9c1cb604b62ccf133ff3f9ce0ca95bddf.tar.xz
Add 'spake2/' from commit 'f6e9d07dffa9a9b39f203c23043f93337ebe1ab6'
git-subtree-dir: spake2 git-subtree-mainline: 1afa40d15b0c2cecc989bdfc67a5251aa5cd5954 git-subtree-split: f6e9d07dffa9a9b39f203c23043f93337ebe1ab6 This moves https://github.com/warner/spake2.rs into the "spake2/" subdirectory of https://github.com/RustCrypto/PAKEs . I'll move the release tags over next, then update the travis config and READMEs.
Diffstat (limited to 'spake2/benches/spake2.rs')
-rw-r--r--spake2/benches/spake2.rs60
1 files changed, 60 insertions, 0 deletions
diff --git a/spake2/benches/spake2.rs b/spake2/benches/spake2.rs
new file mode 100644
index 0000000..8323342
--- /dev/null
+++ b/spake2/benches/spake2.rs
@@ -0,0 +1,60 @@
+#[macro_use]
+extern crate bencher;
+
+extern crate spake2;
+
+use bencher::Bencher;
+use spake2::{Ed25519Group, Identity, Password, SPAKE2};
+
+fn spake2_start(bench: &mut Bencher) {
+ bench.iter(|| {
+ 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(
+ &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))
+}
+*/
+
+fn spake2_start_and_finish(bench: &mut Bencher) {
+ 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(
+ &Password::new(b"password"),
+ &Identity::new(b"idA"),
+ &Identity::new(b"idB"),
+ );
+ s1.finish(msg2_slice)
+ })
+}
+
+benchmark_group!(
+ benches,
+ spake2_start,
+ //spake2_finish,
+ spake2_start_and_finish
+);
+benchmark_main!(benches);