libff
libff copied to clipboard
Reduced Pairing Results with MNT Curves
Why is e(0, any value) !=1 for MNT curves? Where 0 is the identity element of G1 and 1 is the identity element of GT. Or is there a change of notation between curves?
template<typename ppT>
void simple_test(){
libff::G1<ppT> g1;
libff::G2<ppT> g2;
libff::GT<ppT> gt, a;
g1 = libff::G1<ppT>::zero();
g2 = libff::G2<ppT>::random_element();
gt = libff::GT<ppT>::one();
a = ppT::reduced_pairing(g1, g2);
cout << "e(0, any) == 1 " << (a == gt ? "TRUE" : "FALSE") << endl;
g1 = libff::G1<ppT>::random_element();
g2 = libff::G2<ppT>::zero();
gt = libff::GT<ppT>::one();
a = ppT::reduced_pairing(g1, g2);
cout << "e(any, 0) == 1 " << (a == gt ? "TRUE" : "FALSE") << endl;
// return 0;
}
int main () {
libff::inhibit_profiling_info = true;
libff::inhibit_profiling_counters = true;
#ifdef CURVE_BN128
libff::bn128_pp::init_public_params();
cout << "BN128" << endl;
simple_test<libff::bn128_pp>();
#endif
#ifdef CURVE_MNT4
libff::mnt4_pp::init_public_params();
cout << "MNT4" << endl;
simple_test<libff::mnt4_pp>();
#endif
#ifdef CURVE_MNT6
libff::mnt6_pp::init_public_params();
cout << "MNT6" << endl;
simple_test<libff::mnt6_pp>();
#endif
return 0;
}
Here is the link to the code.
GT::one()
is the multiplicative identity element in GT, while e(0, random_element)
is a random element in GT.
GT::one() is the multiplicative identity element in GT, while e(0, random_element) is a random element in GT.
For any bilinear map e
, it must be the case that e(0, y) = 0
. Since the target group is Z_q*, the zero element is 1. So shouldn't this test hold, and this implies there is a bug in libff? (Or alternatively GT::one() returns g
, not 1
)
Hmm I must have misunderstood and thought 0 = generator, but that’s not the case.
I ran into the same bug here, for what it's worth.