Skip to content

Commit

Permalink
feat(repr): switch internal representation to Affine
Browse files Browse the repository at this point in the history
  • Loading branch information
davidrusu committed Nov 4, 2022
1 parent 73de2a5 commit 0b01a98
Show file tree
Hide file tree
Showing 5 changed files with 113 additions and 113 deletions.
8 changes: 4 additions & 4 deletions benches/bench.rs
Expand Up @@ -436,10 +436,10 @@ mod public_key_benches {
let mut msg = [0u8; 1000];
rng.fill_bytes(&mut msg);
let hash = hash_g2(&msg);
let sig = sk.sign_g2(&hash);
let sig = sk.sign_g2(hash);
(pk, hash, sig)
};
b.iter_with_setup(rand_factors, |(pk, hash, sig)| pk.verify_g2(&sig, &hash));
b.iter_with_setup(rand_factors, |(pk, hash, sig)| pk.verify_g2(&sig, hash));
});
}

Expand Down Expand Up @@ -515,7 +515,7 @@ mod secret_key_benches {
let hash = hash_g2(&msg);
(sk, hash)
};
b.iter_with_setup(rand_factors, |(sk, hash)| sk.sign_g2(&hash));
b.iter_with_setup(rand_factors, |(sk, hash)| sk.sign_g2(hash));
});
}

Expand All @@ -531,7 +531,7 @@ mod secret_key_benches {
let hash = hash_g2(&msg);
(sk, hash)
};
b.iter_with_setup(rand_factors, |(sk, hash)| sk.sign_g2(&hash));
b.iter_with_setup(rand_factors, |(sk, hash)| sk.sign_g2(hash));
});
}

Expand Down
8 changes: 4 additions & 4 deletions src/cmp_pairing.rs
@@ -1,10 +1,10 @@
use std::cmp::Ordering;

use group::{prime::PrimeCurve, GroupEncoding};
use group::prime::PrimeCurveAffine;

/// Compares two curve elements and returns their `Ordering`.
pub fn cmp_projective<G: PrimeCurve>(x: &G, y: &G) -> Ordering {
let xc = x.to_affine().to_bytes();
let yc = y.to_affine().to_bytes();
pub fn cmp_affine<G: PrimeCurveAffine>(x: &G, y: &G) -> Ordering {
let xc = x.to_bytes();
let yc = y.to_bytes();
xc.as_ref().cmp(yc.as_ref())
}

0 comments on commit 0b01a98

Please sign in to comment.