diff options
author | MITSUNARI Shigeo <herumi@nifty.com> | 2017-03-11 14:10:05 +0800 |
---|---|---|
committer | MITSUNARI Shigeo <herumi@nifty.com> | 2017-03-11 14:10:05 +0800 |
commit | 9a061f819fef24c7fba3c6e2753e4ffcce932c3d (patch) | |
tree | 7dd0e87c8e6388add5777f441117c832e4479fe2 | |
parent | 702e3e685a7823b197e6612c01cf4f75b34c5ea7 (diff) | |
download | dexon-mcl-9a061f819fef24c7fba3c6e2753e4ffcce932c3d.tar.gz dexon-mcl-9a061f819fef24c7fba3c6e2753e4ffcce932c3d.tar.zst dexon-mcl-9a061f819fef24c7fba3c6e2753e4ffcce932c3d.zip |
change type of z from mpz_class to const char*
-rw-r--r-- | include/mcl/bn.hpp | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/include/mcl/bn.hpp b/include/mcl/bn.hpp index 6798e1e..968204b 100644 --- a/include/mcl/bn.hpp +++ b/include/mcl/bn.hpp @@ -20,18 +20,19 @@ struct CurveParam { v^3 = xi w^2 = v */ - mpz_class z; + const char *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; } bool operator!=(const CurveParam& rhs) const { return !operator==(rhs); } }; -const CurveParam CurveSNARK1 = { mpz_class("4965661367192848881"), 3, 9 }; -//const CurveParam CurveSNARK2 = { 4965661367192848881, 82, 9 }; -const CurveParam CurveFp254BNb = { mpz_class("-0x4080000000000001"), 2, 1 }; // -(2^62 + 2^55 + 1) -const CurveParam CurveFp382_1 = { mpz_class("-0x400011000000000000000001"), 2, 1 }; // -(2^94 + 2^76 + 2^72 + 1) // A Family of Implementation-Friendly BN Elliptic Curves -const CurveParam CurveFp382_2 = { mpz_class("-0x400040090001000000000001"), 2, 1 }; // -(2^94 + 2^78 + 2^67 + 2^64 + 2^48 + 1) // used in relic-toolkit +const CurveParam CurveSNARK1 = { "4965661367192848881", 3, 9 }; +//const CurveParam CurveSNARK2 = { "4965661367192848881", 82, 9 }; +const CurveParam CurveFp254BNb = { "-0x4080000000000001", 2, 1 }; // -(2^62 + 2^55 + 1) +// provisional(experimental) param with maxBitSize = 384 +const CurveParam CurveFp382_1 = { "-0x400011000000000000000001", 2, 1 }; // -(2^94 + 2^76 + 2^72 + 1) // A Family of Implementation-Friendly BN Elliptic Curves +const CurveParam CurveFp382_2 = { "-0x400040090001000000000001", 2, 1 }; // -(2^94 + 2^78 + 2^67 + 2^64 + 2^48 + 1) // used in relic-toolkit template<class Vec> void convertToBinary(Vec& v, const mpz_class& x) @@ -241,8 +242,8 @@ struct ParamT { void init(const CurveParam& cp = CurveFp254BNb, fp::Mode mode = fp::FP_AUTO) { isCurveFp254BNb = cp == CurveFp254BNb; - z = cp.z; - isNegative = cp.z < 0; + z = mpz_class(cp.z); + isNegative = z < 0; if (isNegative) { abs_z = -z; } else { |