We release the source of our library described in the ePrint(High-Speed Software Implementation of the Optimal Ate Pairing over Barreto-Naehrig Curves) and Pairing 2010. The latest version of this library is able to compute the optimal ate pairing over a 254-bit prime field Fp, in just 1.35 million of clock cycles on a single core of an Intel Core i7 2.8GHz processor, which implies that the pairing computation takes 0.399msec.
NEW VERSION[2013/Jun/1]
The new vesion using mulx on Haswell computes the optimal ate pairing in just 1.17 clock cycles on a single core of an Intel Core i7 4700MQ 2.4GHz processor
with TurboBoost technology disabled(eprint).
>cd ate && makethen you can get the test binary in ate/test/bn
| CPU | OS | M clock cycles |
|---|---|---|
| Core i7 2600 3.4GHz(with turbo boost) | Win7 | 1.35 |
| Core i7 2600 3.4GHz(without turbo boost) | Linux | 1.552 |
| opteron 2376 2.3GHz | Linux | 1.669 |
| Xeon x5650 2.67GHz | Linux | 1.630 |
| Core i5 M 520 2.5GHz | Win7 | 1.603 |
| Core2Duo T7100 1.8GHz | Win7 | 1.998 |
| Core2Duo T9400 2.53GHz | Mac | 2.155 |
| Core i7 2720QM 2.2GHz | Mac | 1.078 |
// calc e : G2 x G1 -> G3 pairing
opt_atePairing<Fp>(e, g2, g1); // e = e(g2, g1)
const Fp a("123456789012345");
Fp2 g2a[3];
ecop::ScalarMult(g2a, g2, a); // g2a = g2 * a
ecop::NormalizeJac(g2a, g2a); // Jacobi to Affine
Fp12 ea1;
opt_atePairing<Fp>(ea1, g2a, g1); // ea1 = e(g2a, g1)
Fp12 ea2 = power(e, a); // ea2 = e^a
| Our results | dclxvi[1st version] | ||||||
|---|---|---|---|---|---|---|---|
| Core i7a | Opteronb | Core 2 Duoc | Athlon 64d | Opteronb | Core 2 Quade | Athlon 64d | |
| Multiplication over Fp2 | 435 | 443 | 558 | 473 | 695 | 693 | 1714 |
| Squaring over over Fp2 | 342 | 355 | 445 | 376 | 614 | 558 | 1207 |
| Miller loop | 1.33M | 1.36M | 1.68M | 1.48M | 2.48M | 2.26M | 5.76M |
| Final exponentiation | 1.00M | 1.04M | 1.27M | 1.08M | 2.52M | 2.21M | 5.51M |
| Optimal ate pairing | 2.33M | 2.40M | 2.95M | 2.56M | 5.0M | 4.47M | 11.27M |