Add pairing_with API.

This commit is contained in:
Sean Bowe
2017-07-20 20:52:36 -06:00
parent f51a383ef1
commit 41834bc4b2
3 changed files with 39 additions and 9 deletions

View File

@@ -6,6 +6,14 @@ pub fn engine_tests<E: Engine>()
{
let mut rng = XorShiftRng::from_seed([0x5dbe6259, 0x8d313d76, 0x3237db17, 0xe5bc0654]);
for _ in 0..10 {
let a = E::G1::rand(&mut rng).into_affine();
let b = E::G2::rand(&mut rng).into_affine();
assert!(a.pairing_with(&b) == b.pairing_with(&a));
assert!(a.pairing_with(&b) == E::pairing(a, b));
}
for _ in 0..1000 {
let z1 = E::G1Affine::zero().prepare();
let z2 = E::G2Affine::zero().prepare();