more realistic benchmarks
This commit is contained in:
parent
d21139d9ff
commit
7debf5e213
1 changed files with 7 additions and 6 deletions
|
|
@ -9,7 +9,7 @@ mod benches {
|
|||
use test::{Bencher, black_box};
|
||||
|
||||
#[bench]
|
||||
fn diffie_hellman(b: &mut Bencher) {
|
||||
fn dh_shared_key_derivation(b: &mut Bencher) {
|
||||
let a = Secret::from(U256::from_u32(123456789));
|
||||
let p = Public::from(&Secret::from(U256::from_u64(987654321)));
|
||||
|
||||
|
|
@ -27,7 +27,7 @@ mod benches {
|
|||
|
||||
#[bench]
|
||||
fn montgomery_point_add(b: &mut Bencher) {
|
||||
let p = CURVE_25519.point(U256::from_u32(123456789));
|
||||
let p = CURVE_25519.point(clamp_u256(U256::from_u32(123456789)));
|
||||
let q = p.double();
|
||||
|
||||
b.iter(|| black_box(p.add(&q, &p)))
|
||||
|
|
@ -35,21 +35,22 @@ mod benches {
|
|||
|
||||
#[bench]
|
||||
fn montgomery_point_double(b: &mut Bencher) {
|
||||
let p = CURVE_25519.point(U256::from_u32(123456789));
|
||||
let p = CURVE_25519.point(clamp_u256(U256::from_u32(123456789)));
|
||||
|
||||
b.iter(|| black_box(p.double()))
|
||||
}
|
||||
|
||||
#[bench]
|
||||
fn montgomery_ladder(b: &mut Bencher) {
|
||||
let p = CURVE_25519.point(U256::from_u32(123456789));
|
||||
let p = CURVE_25519.point(clamp_u256(U256::from_u32(123456789)));
|
||||
let v = clamp_u256(U256::from_u64(987654321));
|
||||
|
||||
b.iter(|| black_box(p.ladder(&clamp_u256(U256::from_u64(987654321)))))
|
||||
b.iter(|| black_box(p.ladder(&v)))
|
||||
}
|
||||
|
||||
#[bench]
|
||||
fn constant_time_montgomery_ladder(b: &mut Bencher) {
|
||||
let p = CURVE_25519.point(U256::from_u32(123456789));
|
||||
let p = CURVE_25519.point(clamp_u256(U256::from_u32(123456789)));
|
||||
|
||||
b.iter(|| black_box(p.ct_ladder(&clamp_u256(U256::from_u64(987654321)))))
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue