|
|
@ -286,7 +286,6 @@ CYBOZU_TEST_AUTO(test) |
|
|
|
#if 0 |
|
|
|
#if 0 |
|
|
|
mpz_class p(tbl[i]); |
|
|
|
mpz_class p(tbl[i]); |
|
|
|
initPairing(mcl::BLS12_381); |
|
|
|
initPairing(mcl::BLS12_381); |
|
|
|
printf("FpDbl::mod=%p\n", FpDbl::mod); |
|
|
|
|
|
|
|
#if 1 |
|
|
|
#if 1 |
|
|
|
cybozu::XorShift rg; |
|
|
|
cybozu::XorShift rg; |
|
|
|
for (int i = 0; i < 1000; i++) { |
|
|
|
for (int i = 0; i < 1000; i++) { |
|
|
@ -308,18 +307,23 @@ printf("FpDbl::mod=%p\n", FpDbl::mod); |
|
|
|
} |
|
|
|
} |
|
|
|
#else |
|
|
|
#else |
|
|
|
Montgomery mont(p); |
|
|
|
Montgomery mont(p); |
|
|
|
mpz_class xy1("00783239517141aafb2ffc854bebe27a47655610fa048c1bb6482ba78a79f232c9043ac4a898274ced5b2f65cf281204f4266605b5602ca09cacd1ea9e650c7936a436836ecfd3861d601ef424dbd6e8dbc8c71e9bc7da343f640cf5dffb903f", 16); |
|
|
|
mpz_class x("19517141aafb2ffc39517141aafb2ffc39517141aafb2ffc39517141aafb2ffc39517141aafb2ffc39517141aafb2ffc", 16); |
|
|
|
// mpz_class xy1 = (mpz_class(1) << (64 * 12 - 4)) - 1;
|
|
|
|
mpz_class y("139517141aafb2ffc39517141aafb2ffc39517141aafb2ffc39517141aafb2ffc39517141aafb2ffc39517141aafb2ff", 16); |
|
|
|
mpz_class z1; |
|
|
|
std::cout << std::hex; |
|
|
|
mont.mod(z1, xy1); |
|
|
|
PUT(x); |
|
|
|
std::cout << "1=" << z1 << std::endl; |
|
|
|
PUT(y); |
|
|
|
FpDbl xy2, z2; |
|
|
|
mpz_class z; |
|
|
|
Fp z3; |
|
|
|
mont.mul(z, x, y); |
|
|
|
z3.clear(); |
|
|
|
PUT(z); |
|
|
|
xy2.setMpz(xy1); |
|
|
|
Fp x1, y1, z1; |
|
|
|
xy2.dump(); |
|
|
|
puts("aaa"); |
|
|
|
FpDbl::mod(z3, xy2); |
|
|
|
memcpy(&x1, mcl::gmp::getUnit(x), sizeof(x1)); |
|
|
|
z3.dump(); |
|
|
|
memcpy(&y1, mcl::gmp::getUnit(y), sizeof(y1)); |
|
|
|
|
|
|
|
z1.clear(); |
|
|
|
|
|
|
|
x1.dump(); |
|
|
|
|
|
|
|
y1.dump(); |
|
|
|
|
|
|
|
Fp::mul(z1, x1, y1); |
|
|
|
|
|
|
|
z1.dump(); |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
exit(1); |
|
|
|
exit(1); |
|
|
|
#endif |
|
|
|
#endif |
|
|
|