|
|
|
@ -20,7 +20,7 @@ struct CurveParam { |
|
|
|
|
v^3 = xi |
|
|
|
|
w^2 = v |
|
|
|
|
*/ |
|
|
|
|
int64_t z; |
|
|
|
|
mpz_class z; |
|
|
|
|
int b; // y^2 = x^3 + b
|
|
|
|
|
int xi_a; // xi = xi_a + i
|
|
|
|
|
bool operator==(const CurveParam& rhs) const { return z == rhs.z && b == rhs.b && xi_a == rhs.xi_a; } |
|
|
|
@ -239,15 +239,12 @@ struct ParamT { |
|
|
|
|
void init(const CurveParam& cp = CurveFp254BNb, fp::Mode mode = fp::FP_AUTO) |
|
|
|
|
{ |
|
|
|
|
isCurveFp254BNb = cp == CurveFp254BNb; |
|
|
|
|
{ |
|
|
|
|
uint64_t t = std::abs(cp.z); |
|
|
|
|
z = cp.z; |
|
|
|
|
isNegative = cp.z < 0; |
|
|
|
|
gmp::setArray(abs_z, &t, 1); |
|
|
|
|
if (isNegative) { |
|
|
|
|
z = -abs_z; |
|
|
|
|
abs_z = -z; |
|
|
|
|
} else { |
|
|
|
|
z = abs_z; |
|
|
|
|
} |
|
|
|
|
abs_z = z; |
|
|
|
|
} |
|
|
|
|
const int pCoff[] = { 1, 6, 24, 36, 36 }; |
|
|
|
|
const int rCoff[] = { 1, 6, 18, 36, 36 }; |
|
|
|
|