21inline size_t M_bitLen(
const mpz_class& x)
23 return mpz_sizeinbase(x.get_mpz_t(), 2);
25inline size_t M_blockSize(
const mpz_class& x)
27 return x.get_mpz_t()->_mp_size;
29inline mp_limb_t M_block(
const mpz_class& x,
size_t i)
31 return x.get_mpz_t()->_mp_d[i];
33inline uint32_t M_low32bit(
const mpz_class& x)
40struct IntTag<mpz_class> {
48 return M_blockSize(x);
77#ifdef BN_SUPPORT_SNARK
78const CurveParam CurveSNARK1 = { 4965661367192848881, 3, 9, 1 };
81const CurveParam CurveSNARK2 = { 4965661367192848881, 82, 9, 1 };
92 for (
size_t i = 0; i <
len; i++) {
93 printf(
"% 2d,", x[i]);
107 for (
size_t i = 0; i <
len; i++) {
115 if (v[pos] != val)
break;
124 size_t pos = v.size() - 1;
137 for (
size_t i = q + 1; i <
p; i++) {
148 for (
size_t i = 0; i < v.size(); i++) {
202#ifdef BN_SUPPORT_SNARK
206 static inline void init(
const CurveParam& cp,
int mode = -1,
bool useMulx =
true)
208#ifdef BN_SUPPORT_SNARK
209 bool supported = cp == CurveSNARK1 || cp == CurveSNARK2;
214 fprintf(stderr,
"not supported parameter\n");
219 const int pCoff[] = { 1, 6, 24, 36, 36 };
220 const int rCoff[] = { 1, 6, 18, 36, 36 };
221 const int tCoff[] = { 1, 0, 6, 0, 0 };
239 for (
size_t i = 1; i <
sizeof(
gammar) /
sizeof(*gammar); ++i) {
243 for (
size_t i = 0; i <
sizeof(
gammar2) /
sizeof(*gammar2); ++i) {
247 for (
size_t i = 0; i <
sizeof(
gammar2) /
sizeof(*gammar2); ++i) {
254 assert(temp.
b_.isZero());
260#ifdef BN_SUPPORT_SNARK
264 static inline void init(
int mode = -1,
bool useMulx =
true)
266#ifdef BN_SUPPORT_SNARK
267 init(CurveSNARK1, mode, useMulx);
275 template<
class T,
class U>
276 static void eval(
T& y,
const U& x,
const int* c) {
277 U tmp = (((c[4] * x + c[3]) * x + c[2]) * x + c[1]) * x + c[0];
324#ifdef BN_SUPPORT_SNARK
332template<
class F,
class G>
335 G::mul_xi(z.a_, x.c_);
337 G::add(z.b_, x.a_, y.b_);
338 G::add(z.c_, x.b_, y.c_);
348 , mie::local::hasNegative<Fp2T<T> > > {
366 return a_.isZero() &&
b_.isZero();
423 Fp::Dbl::mod(z.
b_,
d[0]);
425 Fp::Dbl::mod(z.
a_,
d[1]);
440#ifdef BN_SUPPORT_SNARK
483#ifdef BN_SUPPORT_SNARK
532 is >> cl >> x.
a_ >> cm >> x.
b_ >> cr;
533 if (cl ==
'[' && cm ==
',' && cr ==
']')
return is;
534 throw std::ios_base::failure(
"bad Fp2");
538 return a_ == rhs.
a_ &&
b_ == rhs.
b_;
542 void set(
const std::string& str)
544 std::istringstream iss(str);
614 Dbl(
const std::string&
a,
const std::string& b)
639 return a_.isZero() &&
b_.isZero();
644 return x.
a_ == y.a_ && x.
b_ == y.b_;
694#ifdef BN_SUPPORT_SNARK
837 mie::local::hasNegative<Fp6T<T> > > {
839 typedef typename T::Fp
Fp;
881 return a_.isZero() &&
b_.isZero() &&
c_.isZero();
940 Fp2 t0, t1, t2, t4, t5;
972 return os <<
"[" << x.
a_ <<
",\n " << x.
b_ <<
",\n " << x.
c_ <<
"]";
977 is >> c1 >> x.
a_ >> c2 >> x.
b_ >> c3 >> x.
c_ >> c4;
978 if (c1 ==
'[' && c2 ==
',' && c3 ==
',' && c4 ==
']')
return is;
979 throw std::ios_base::failure(
"bad Fp6");
1003 Fp2 t0, t1, t2, t3, t4, t5;
1019#ifdef BN_SUPPORT_SNARK
1056#ifdef BN_SUPPORT_SNARK
1193 Dbl(
const std::string& a0,
const std::string& a1,
const std::string& b0,
const std::string& b1,
const std::string& c0,
const std::string& c1)
1221 return x.
a_ == y.a_ && x.
b_ == y.b_ && x.
c_ == y.c_;
1304#ifdef BN_SUPPORT_SNARK
1384 const Fp& a6,
const Fp& a7,
const Fp& a8,
const Fp& a9,
const Fp& a10,
const Fp& a11)
1385 :
a_(a0, a1, a2, a3, a4, a5)
1386 ,
b_(a6, a7, a8, a9, a10, a11)
1414 return a_.isZero() &&
b_.isZero();
1418 return a_ == rhs.
a_ &&
b_ == rhs.
b_;
1423 return os <<
"[" << x.
a_ <<
",\n " << x.
b_ <<
"]";
1428 is >> c1 >> x.
a_ >> c2 >> x.
b_ >> c3;
1429 if (c1 ==
'[' && c2 ==
',' && c3 ==
']')
return is;
1430 throw std::ios_base::failure(
"bad Fp12");
1644 z.
a_.a_.a_ =
a_.a_.a_;
1645 z.
a_.b_.a_ =
a_.b_.a_;
1646 z.
a_.c_.a_ =
a_.c_.a_;
1647 z.
b_.a_.a_ =
b_.a_.a_;
1648 z.
b_.b_.a_ =
b_.b_.a_;
1649 z.
b_.c_.a_ =
b_.c_.a_;
1657#ifdef BN_SUPPORT_SNARK
1702 z.
a_.a_.a_ =
a_.a_.a_;
1703 z.
a_.b_.a_ =
a_.b_.a_;
1704 z.
a_.c_.a_ =
a_.c_.a_;
1705 z.
b_.a_.a_ =
b_.a_.a_;
1706 z.
b_.b_.a_ =
b_.b_.a_;
1707 z.
b_.c_.a_ =
b_.c_.a_;
1715#ifdef BN_SUPPORT_SNARK
1755#ifdef BN_SUPPORT_SNARK
1756 static void pow_neg_t(
Fp12T &out,
const Fp12T &in)
1763 for (
size_t i = 1; i < Param::zReplTbl.size(); i++) {
1765 if (Param::zReplTbl[i] > 0) {
1767 }
else if (Param::zReplTbl[i] < 0) {
1778 Fp12T f, f2z, f6z, f6z2, f12z3;
1783#ifdef BN_SUPPORT_SNARK
1784 Fp12T::pow_neg_t(f2z,
f);
1788 Fp12T::pow_neg_t(f6z2, f6z);
1792 Fp12T::pow_neg_t(f12z3,
a);
1883 Dbl(
const std::string&
a,
const std::string& b)
1900 return x.
a_ == y.a_ && x.
b_ == y.b_;
1972 const Fp2& x0 = x.a_;
1973 const Fp2& x2 = x.c_;
1974 const Fp2& x4 = x.b_;
2073 const Fp2& x0 = cv2.a_;
2074 const Fp2& x2 = cv2.c_;
2075 const Fp2& x4 = cv2.b_;
2076 const Fp2& y0 = cv3.a_;
2077 const Fp2& y2 = cv3.c_;
2078 const Fp2& y4 = cv3.b_;
2079 Fp2Dbl T00, T22, T44, T02, T24, T40;
2147 ,
g1_(z.getFp2()[4])
2148 ,
g2_(z.getFp2()[3])
2149 ,
g3_(z.getFp2()[2])
2150 ,
g4_(z.getFp2()[1])
2151 ,
g5_(z.getFp2()[5])
2160 ,
g1_(z.getFp2()[4])
2161 ,
g2_(z.getFp2()[3])
2162 ,
g3_(z.getFp2()[2])
2163 ,
g4_(z.getFp2()[1])
2164 ,
g5_(z.getFp2()[5])
2174 os <<
"C[" << x.
g2_ <<
",\n" << x.
g3_ <<
",\n" << x.
g4_ <<
",\n" << x.
g5_ <<
",\n" <<
"]";
2179 void decompressBeforeInv(
Fp2& nume,
Fp2& denomi)
const
2181 assert(&nume != &denomi);
2202 void decompressAfterInv()
2223 decompressBeforeInv(nume, denomi);
2225 g1_ = nume * denomi;
2226 decompressAfterInv();
2301 for (
int i = 0; i < n; i++) {
2317 Fp2 c55nume, c55denomi, c62nume, c62denomi;
2320 c55.decompressBeforeInv(c55nume, c55denomi);
2323 c62.decompressBeforeInv(c62nume, c62denomi);
2325 Fp2::mul(acc, c55denomi, c62denomi);
2330 c55.decompressAfterInv();
2333 c62.decompressAfterInv();
2350inline void copy(FF* out,
const FF* in)
2365 if (
P[2] == 0)
return true;
2372 return P[1] *
P[1] ==
P[0] *
P[0] *
P[0] + Z6p_2;
2396 if (
P[2] == 0)
return true;
2402 return P[1] *
P[1] *
P[2] ==
P[0] *
P[0] *
P[0] + ZZZ;
2414 if (
P[2] == 0)
return true;
2443 if (
P[2] == 0)
return true;
2457 }
else if (in[2] == 1) {
2464 FF::mul(out[0], in[0], AA);
2466 FF::mul(out[1], in[1], t0);
2481 }
else if (in[2] == 1) {
2486 FF::mul(out[0], in[0],
A);
2487 FF::mul(out[1], in[1],
A);
2499 FF
A,
B, C,
D, E, F, t0, t1, t2, t3, t4, t5, t6, t7, t8;
2500 FF::square(
A, in[0]);
2501 FF::square(
B, in[1]);
2503 FF::add(t0, in[0],
B);
2512 FF::sub(out[0], F, t4);
2513 FF::sub(t5,
D, out[0]);
2514 t6 = C; t6 += t6; t6 += t6; t6 += t6;
2516 FF::mul(t8, in[1], in[2]);
2517 FF::sub(out[1], t7, t6);
2518 FF::add(out[2], t8, t8);
2526inline void ECAdd(FF* out,
const FF*
a,
const FF* b)
2528 if (
a[2].isZero()) {
2532 if (b[2].isZero()) {
2536 FF Z1Z1, Z2Z2, U1, U2, t0, S1, t1, S2, H, t2, I, J, t3,
r,
V, t4, t5;
2537 FF t6, t7, t8, t9, t10, t11, t12, t13, t14;
2538 FF::square(Z1Z1,
a[2]);
2539 FF::square(Z2Z2, b[2]);
2540 FF::mul(U1,
a[0], Z2Z2);
2541 FF::mul(U2, b[0], Z1Z1);
2542 FF::mul(t0, b[2], Z2Z2);
2543 FF::mul(S1,
a[1], t0);
2544 FF::mul(t1,
a[2], Z1Z1);
2545 FF::mul(S2, b[1], t1);
2547 FF::sub(t3, S2, S1);
2566 FF::sub(out[0], t6, t5);
2567 FF::sub(t7,
V, out[0]);
2569 FF::add(t9, t8, t8);
2570 FF::mul(t10,
r, t7);
2571 FF::sub(out[1], t10, t9);
2572 FF::add(t11,
a[2], b[2]);
2573 FF::square(t12, t11);
2574 FF::sub(t13, t12, Z1Z1);
2575 FF::sub(t14, t13, Z2Z2);
2576 FF::mul(out[2], t14, H);
2589template<
class FF,
class INT>
2593 typedef typename Tag::value_type value_type;
2607 const int mSize = (int)Tag::getBlockSize(m);
2608 const int vSize = (int)
sizeof(value_type) * 8;
2609 const value_type mask = value_type(1) << (vSize - 1);
2614 value_type v = Tag::getBlock(m, mSize - 1);
2617 while ((v != 0) && (!(v & mask))) {
2628 for (;
j != vSize; ++
j, v <<= 1) {
2631 ECAdd(out, out, in);
2638 for (
int i = mSize - 2; i >= 0; --i) {
2639 v = Tag::getBlock(m, i);
2640 for (
j = 0;
j != vSize; ++
j, v <<= 1) {
2643 ECAdd(out, out, in);
2655#ifdef BN_SUPPORT_SNARK
2681#ifdef BN_SUPPORT_SNARK
2696#ifdef BN_SUPPORT_SNARK
2697 Fp2T<Fp> scratch2[2], scratch4[2], scratch6[2];
2741 Fp12::Dbl::mul_Fp2_024_Fp2_024(
f,
d, e);
2751 Fp12::Dbl::mul_Fp2_024(
f,
l);
2757 Fp12::Dbl::mul_Fp2_024(
f,
l);
2761 Fp12::Dbl::mul_Fp2_024(
f,
l);
2769#ifdef BN_SUPPORT_SNARK
2781 Fp12::Dbl::mul_Fp2_024_Fp2_024(ft,
d, e);
2797 if (_Q[2] == 0 || _P[2] == 0) {
2810 #pragma warning(push)
2811 #pragma warning(disable : 4127)
2829 if (
isZero() ||
p[2] == 1)
return;
2848 throw std::runtime_error(
"set(x, y) : bad point");
2857 throw std::runtime_error(
"set(x, y, z) : bad point");
2884 T::neg(
R.p[1],
P.p[1]);
2901 if (rhs.
isZero())
return true;
2904 if (rhs.
isZero())
return false;
2905 return p[0] == rhs.
p[0] &&
p[1] == rhs.
p[1];
2913 return p[2].isZero();
2917 if (self.isZero()) {
2921 return os << self.p[0].toString(16) <<
'_' << self.p[1].toString(16);
2932 size_t pos = str.find(
'_');
2933 if (pos == std::string::npos) {
2934 throw std::runtime_error(
"operator>>:bad format");
2937 self.p[0].set(&str[0]);
2938 self.p[1].set(&str[pos + 1]);
2949 #pragma warning(pop)
2970 if (Q.
isZero() ||
P.isZero()) {
2992namespace components {
3041#ifdef BN_SUPPORT_SNARK
3065 Fp6 d = Qcoeff[idx];
3069 Fp6 e = Qcoeff[idx];
3071 Fp12::Dbl::mul_Fp2_024_Fp2_024(
f,
d, e);
3081 Fp12::Dbl::mul_Fp2_024(
f,
l);
3087 Fp12::Dbl::mul_Fp2_024(
f,
l);
3091#ifndef BN_SUPPORT_SNARK
3104 Fp12::Dbl::mul_Fp2_024_Fp2_024(ft,
d, e);
3109 const std::vector<Fp6>& Q2coeff,
const Fp precP2[2])
3114 Fp6 d1 = Q1coeff[idx];
3116 Fp6 d2 = Q2coeff[idx];
3121 Fp6 e1 = Q1coeff[idx];
3123 Fp12::Dbl::mul_Fp2_024_Fp2_024(f1,
d1, e1);
3126 Fp6 e2 = Q2coeff[idx];
3128 Fp12::Dbl::mul_Fp2_024_Fp2_024(f2, d2, e2);
3142 Fp12::Dbl::mul_Fp2_024_Fp2_024(f1, l1, l2);
3151 Fp12::Dbl::mul_Fp2_024_Fp2_024(f1, l1, l2);
3156#ifndef BN_SUPPORT_SNARK
3174 Fp12::Dbl::mul_Fp2_024_Fp2_024(f1,
d1, e1);
3175 Fp12::Dbl::mul_Fp2_024_Fp2_024(f2, d2, e2);
std::string toString() const
bool operator!=(const EcT &rhs) const
friend EcT operator+(const EcT &a, const EcT &b)
EcT(const T &x, const T &y, const T &z, bool verify=true)
EcT(const T &x, const T &y, bool verify=true)
void set(const T &x, const T &y, const T &z, bool verify=true)
EcT & operator-=(const EcT &rhs)
friend std::istream & operator>>(std::istream &is, EcT &self)
static void dbl(EcT &R, const EcT &P)
static void sub(EcT &R, const EcT &P, const EcT &Q)
EcT operator*(const N &y) const
EcT & operator*=(const N &y)
bool operator==(const EcT &rhs) const
friend std::ostream & operator<<(std::ostream &os, const EcT &self)
static void add(EcT &R, const EcT &P, const EcT &Q)
EcT & operator+=(const EcT &rhs)
friend EcT operator-(const EcT &a, const EcT &b)
static void neg(EcT &R, const EcT &P)
static void mul(EcT &R, const EcT &P, const N &y)
void set(const T &x, const T &y, bool verify=true)
static void(* add)(Fp &out, const Fp &x, const Fp &y)
static void(* addNC)(Fp &out, const Fp &x, const Fp &y)
static void(* mul)(Fp &out, const Fp &x, const Fp &y)
static void inv(Fp &out, const Fp &x)
static const Fp & getDirectP(int n)
static void _3z_add_2xC(Fp &z, const Fp &x)
static void divBy2(Fp &z, const Fp &x)
static void(* neg)(Fp &out, const Fp &x)
static void divBy4(Fp &z, const Fp &x)
static void(* sub)(Fp &out, const Fp &x, const Fp &y)
static void(* subNC)(Fp &out, const Fp &x, const Fp &y)
static void _2z_add_3x(Fp &z, const Fp &x)
static void setModulo(const mie::Vuint &p, int mode, bool useMulx=true, bool definedBN_SUPPORT_SNARK=false)
static void square(Fp &out, const Fp &x)
#define D(var, file, col, who, lev,...)
void verify(const char *msg, const T &a, const S &b)
void millerLoop2(Fp12 &f, const std::vector< Fp6 > &Q1coeff, const Fp precP1[2], const std::vector< Fp6 > &Q2coeff, const Fp precP2[2])
void millerLoop(Fp12 &f, const std::vector< Fp6 > &Qcoeff, const Fp precP[2])
void precomputeG2(std::vector< Fp6 > &coeff, Fp2 Q[3], const Fp2 inQ[3])
void ECDouble(FF *out, const FF *in)
bool isOnTwistECJac3(const Fp2T< Fp > *P)
bool isOnECHom3(const Fp *P)
void copy(FF *out, const FF *in)
void FrobEndOnTwist_2(Fp2T< Fp > *Q, const Fp2T< Fp > *P)
void ScalarMult(FF *out, const FF *in, const INT &m)
bool isOnTwistECHom3(const Fp2T< Fp > *P)
void NormalizeJac(FF *out, const FF *in)
void NormalizeHom(FF *out, const FF *in)
bool isOnTwistECHom2(const Fp2T< Fp > *P)
void ECAdd(FF *out, const FF *a, const FF *b)
bool isOnECJac3(const Fp *P)
void FrobEndOnTwist_8(Fp2T< Fp > *Q, const Fp2T< Fp > *P)
bool isOnECHom2(const Fp *P)
void FrobEndOnTwist_1(Fp2T< Fp > *Q, const Fp2T< Fp > *P)
void convertToBinary(Vec &v, const mie::Vuint &x)
bool getGoodRepl(Vec &v, const mie::Vuint &x)
size_t getNumOfNonZeroElement(const Vec &v)
size_t getContinuousVal(const Vec &v, size_t pos, int val)
void convertToNAF(Vec &v, const Vec &in)
void opt_atePairingJac(Fp12T< Fp6T< Fp2T< Fp > > > &f, const Fp2T< Fp > _Q[3], const Fp _P[3])
CompressT< Fp2 > Compress
void(* CompressT)(CompressT &, int)
const CurveParam CurveFp254BNb
void opt_atePairing(Fp12T< Fp6T< Fp2T< Fp > > > &f, const Fp2T< Fp > Q[2], const Fp P[2])
void mul_gamma_add(F &z, const F &x, const F &y)
T power(const T &x, const S &y)
const GenericPointer< typename T::ValueType > T2 T::AllocatorType & a
#define T(meth, val, expected)
unsigned __int64 uint64_t
static void squareC(CompressT &z)
CompressT(Fp12 &z, const CompressT &c)
CompressT(Fp12 &z, const Fp12 &x)
static void fixed_power(Fp12 &z, const Fp12 &x)
static void(* square_n)(CompressT &z, int n)
static void square_nC(CompressT &z, int n)
friend std::ostream & operator<<(std::ostream &os, const CompressT &x)
bool operator==(const CurveParam &rhs) const
bool operator!=(const CurveParam &rhs) const
void setDirect(const Fp6Dbl &a, const Fp6Dbl &b)
static void mod(Fp12T &z, Dbl &x)
const Fp6Dbl * get() const
static void subNC(Dbl &z, const Dbl &x, const Dbl &y)
Dbl(const Fp6Dbl &a, const Fp6Dbl &b)
friend std::ostream & operator<<(std::ostream &os, const Dbl &x)
std::string toString(int base=10) const
static void addNC(Dbl &z, const Dbl &x, const Dbl &y)
static void add(Dbl &z, const Dbl &x, const Dbl &y)
friend bool operator==(const Dbl &x, const Dbl &y)
static void sub(Dbl &z, const Dbl &x, const Dbl &y)
friend bool operator!=(const Dbl &x, const Dbl &y)
static void mul_Fp2_024_Fp2_024(Fp12T &z, const Fp6 &cv2, const Fp6 &cv3)
static void(* mul_Fp2_024)(Fp12T &z, const Fp6 &x)
Dbl(const Fp6 &a, const Fp6 &b)
void bin_op(Dbl &, const Dbl &, const Dbl &)
static void neg(Dbl &z, const Dbl &x)
void uni_op(Dbl &, const Dbl &)
Dbl(const std::string &a, const std::string &b)
static void mul_Fp2_024C(Fp12T &z, const Fp6 &x)
Fp12T(const Fp &a0, const Fp &a1, const Fp &a2, const Fp &a3, const Fp &a4, const Fp &a5, const Fp &a6, const Fp &a7, const Fp &a8, const Fp &a9, const Fp &a10, const Fp &a11)
static void mulC(Fp12T &z, const Fp12T &x, const Fp12T &y)
friend std::istream & operator>>(std::istream &is, Fp12T &x)
static void sq_Fp4UseDbl(Fp2 &z0, Fp2 &z1, const Fp2 &x0, const Fp2 &x1)
void set(const Fp2 &v0, const Fp2 &v1, const Fp2 &v2, const Fp2 &v3, const Fp2 &v4, const Fp2 &v5)
static void squareC(Fp12T &z)
void mapToCyclo(Fp12T &z)
void Frobenius(Fp12T &z) const
static void neg(Fp12T &z, const Fp12T &x)
bool operator==(const Fp12T &rhs) const
static void(* mul)(Fp12T &z, const Fp12T &x, const Fp12T &y)
void Frobenius3(Fp12T &z) const
bool operator!=(const Fp12T &rhs) const
void Fp2_2z_add_3x(Fp2 &z, const Fp2 &x)
Fp12T(const Fp6 &a, const Fp6 &b)
static void add(Fp12T &z, const Fp12T &x, const Fp12T &y)
static void sub(Fp12T &z, const Fp12T &x, const Fp12T &y)
void Frobenius2(Fp12T &z) const
void sqru(Fp12T &zz) const
friend std::ostream & operator<<(std::ostream &os, const Fp12T &x)
static void(* square)(Fp12T &z)
Fp12T(const Fp2 &a0, const Fp2 &a1, const Fp2 &a2, const Fp2 &a3, const Fp2 &a4, const Fp2 &a5)
const Fp2 * getFp2() const
static void(* mod)(Fp2T &z, const Dbl &x)
void bin_op(Dbl &, const Dbl &, const Dbl &)
Dbl(const FpDbl &a, const FpDbl &b)
std::string toString(int base=10) const
Dbl(const Fp &a, const Fp &b)
friend std::ostream & operator<<(std::ostream &os, const Dbl &x)
void setDirect(const mie::Vuint &a, const mie::Vuint &b)
static void mulOptC(Dbl &z, const Fp2T &x, const Fp2T &y, int mode)
static void(* square)(Dbl &z, const Fp2T &x)
static void squareC(Dbl &z, const Fp2T &x)
static void mulOpt1C(Dbl &z, const Fp2T &x, const Fp2T &y)
static void addC(Dbl &z, const Dbl &x, const Dbl &y)
friend bool operator==(const Dbl &x, const Dbl &y)
static void subC(Dbl &z, const Dbl &x, const Dbl &y)
friend bool operator!=(const Dbl &x, const Dbl &y)
static void modC(Fp2T &z, const Dbl &x)
static void(* mulOpt1)(Dbl &z, const Fp2T &x, const Fp2T &y)
static void(* mulOpt2)(Dbl &z, const Fp2T &x, const Fp2T &y)
void uni_op(Dbl &, const Dbl &)
const FpDbl * get() const
static void mulOpt2C(Dbl &z, const Fp2T &x, const Fp2T &y)
static void subNC_C(Dbl &z, const Dbl &x, const Dbl &y)
void setDirect(const FpDbl &a, const FpDbl &b)
static void negC(Dbl &z, const Dbl &x)
static void addNC_C(Dbl &z, const Dbl &x, const Dbl &y)
static void mul_xiC(Dbl &z, const Dbl &x)
Dbl(const std::string &a, const std::string &b)
static void subC(Fp2T &z, const Fp2T &x, const Fp2T &y)
std::string toString(int base=10) const
static void squareC(Fp2T &z, const Fp2T &x)
static void neg(Fp2T &z, const Fp2T &x)
static void mul_xiC(Fp2T &z, const Fp2T &x)
static void(* square)(Fp2T &z, const Fp2T &x)
static void addNC_C(Fp2T &z, const Fp2T &x, const Fp2T &y)
static void mul_Fp_1(Fp2T &z, const Fp &y_b)
static void(* addNC)(Fp2T &z, const Fp2T &x, const Fp2T &y)
static void(* divBy2)(Fp2T &z, const Fp2T &x)
bool operator!=(const Fp2T &rhs) const
friend std::ostream & operator<<(std::ostream &os, const Fp2T &x)
static void divBy4(Fp2T &z, const Fp2T &x)
static void(* mul_Fp_0)(Fp2T &z, const Fp2T &x, const Fp &b)
Fp2T(const Fp &a, const Fp &b)
static void mulC(Fp2T &z, const Fp2T &x, const Fp2T &y)
bool operator==(const Fp2T &rhs) const
static void mul_Fp_0C(Fp2T &z, const Fp2T &x, const Fp &b)
static void(* sub)(Fp2T &z, const Fp2T &x, const Fp2T &y)
static void subNC_C(Fp2T &z, const Fp2T &x, const Fp2T &y)
static void addC(Fp2T &z, const Fp2T &x, const Fp2T &y)
static void divBy2C(Fp2T &z, const Fp2T &x)
static void(* mul_xi)(Fp2T &z, const Fp2T &x)
friend std::istream & operator>>(std::istream &is, Fp2T &x)
static void(* add)(Fp2T &z, const Fp2T &x, const Fp2T &y)
void set(const std::string &str)
static void(* mul)(Fp2T &z, const Fp2T &x, const Fp2T &y)
static void(* subNC)(Fp2T &z, const Fp2T &x, const Fp2T &y)
static void sub(Dbl &z, const Dbl &x, const Dbl &y)
static void(* mul)(Dbl &, const Fp6T &x, const Fp6T &y)
Dbl(const std::string &a0, const std::string &a1, const std::string &b0, const std::string &b1, const std::string &c0, const std::string &c1)
void bin_op(Dbl &, const Dbl &, const Dbl &)
static void mulC(Dbl &z, const Fp6T &x, const Fp6T &y)
static void subNC(Dbl &z, const Dbl &x, const Dbl &y)
friend std::ostream & operator<<(std::ostream &os, const Dbl &x)
static void neg(Dbl &z, const Dbl &x)
Dbl(const Fp2 &a, const Fp2 &b, const Fp2 &c)
void setDirect(const Fp2Dbl &a, const Fp2Dbl &b, const Fp2Dbl &c)
void uni_op(Dbl &, const Dbl &)
friend bool operator==(const Dbl &x, const Dbl &y)
friend bool operator!=(const Dbl &x, const Dbl &y)
const Fp2Dbl * get() const
static void mod(Fp6T &z, const Dbl &x)
void setDirect(const mie::Vuint &v0, const mie::Vuint &v1, const mie::Vuint &v2, const mie::Vuint &v3, const mie::Vuint &v4, const mie::Vuint &v5)
static void addNC(Dbl &z, const Dbl &x, const Dbl &y)
std::string toString(int base=10) const
static void add(Dbl &z, const Dbl &x, const Dbl &y)
Dbl(const Fp2Dbl &a, const Fp2Dbl &b, const Fp2Dbl &c)
static void mulFp6_24_Fp_01(Fp6T &l, const Fp *P)
static void(* pointDblLineEvalWithoutP)(Fp6T &l, Fp2 *R)
static void mul_Fp_c(Fp6T &z, const Fp &x)
static void square(Fp6T &z, const Fp6T &x)
Fp6T(const Fp2 &a, const Fp2 &b, const Fp2 &c)
static void subC(Fp6T &z, const Fp6T &x, const Fp6T &y)
static void pointAddLineEval(Fp6T &l, Fp2 *R, const Fp2 *Q, const Fp *P)
static void neg(Fp6T &z, const Fp6T &x)
static void(* pointDblLineEval)(Fp6T &l, Fp2 *R, const Fp *P)
static void(* sub)(Fp6T &z, const Fp6T &x, const Fp6T &y)
bool operator!=(const Fp6T &rhs) const
friend std::ostream & operator<<(std::ostream &os, const Fp6T &x)
Fp6T(const Fp &a0, const Fp &a1, const Fp &a2, const Fp &a3, const Fp &a4, const Fp &a5)
static void pointDblLineEvalWithoutPC(Fp6T &l, Fp2 *R)
const Fp2 * getFp2() const
static void mulC(Fp6T &z, const Fp6T &x, const Fp6T &y)
static void(* add)(Fp6T &z, const Fp6T &x, const Fp6T &y)
void set(const Fp2 &v0, const Fp2 &v1, const Fp2 &v2)
friend std::istream & operator>>(std::istream &is, Fp6T &x)
static void addC(Fp6T &z, const Fp6T &x, const Fp6T &y)
static void mul_Fp_b(Fp6T &z, const Fp &x)
bool operator==(const Fp6T &rhs) const
static void(* mul)(Fp6T &z, const Fp6T &x, const Fp6T &y)
static void pointDblLineEvalC(Fp6T &l, Fp2 *R, const Fp *P)
static void pointAddLineEvalWithoutP(Fp6T &l, Fp2 *R, const Fp2 *Q)
static void init(int mode=-1, bool useMulx=true)
static mie::Vsint largest_c
std::vector< signed char > SignVec
static void init(const CurveParam &cp, int mode=-1, bool useMulx=true)
static void eval(T &y, const U &x, const int *c)
MIE_FORCE_INLINE void clear()
static void subOpt1(Dbl &z, const Dbl &x, const Dbl &y)
static MIE_FORCE_INLINE void setDirect(Dbl &out, const mie::Vuint &in)
std::string toString(int base=10) const
static void(* mod)(Fp &z, const Dbl &x)
static void(* mul)(Dbl &z, const Fp &x, const Fp &y)
bool testBit(size_t i) const
static size_t getBlockSize(const T &x)
static value_type getBlock(const T &x, size_t i)