aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorMITSUNARI Shigeo <herumi@nifty.com>2016-04-30 05:30:18 +0800
committerMITSUNARI Shigeo <herumi@nifty.com>2016-04-30 05:30:18 +0800
commit27678c4db3531628ca1a43783da375b0778eb3f8 (patch)
treec51d3a36fef4c9a709a98a4a5b21ccce8201b348 /include
parent263b988f1b9ac7a55f00096c316ea21c337152d3 (diff)
downloadtangerine-mcl-27678c4db3531628ca1a43783da375b0778eb3f8.tar.gz
tangerine-mcl-27678c4db3531628ca1a43783da375b0778eb3f8.tar.zst
tangerine-mcl-27678c4db3531628ca1a43783da375b0778eb3f8.zip
fix isValidProj
Diffstat (limited to 'include')
-rw-r--r--include/mcl/ec.hpp10
1 files changed, 4 insertions, 6 deletions
diff --git a/include/mcl/ec.hpp b/include/mcl/ec.hpp
index 3e6fb0e..95b5623 100644
--- a/include/mcl/ec.hpp
+++ b/include/mcl/ec.hpp
@@ -96,7 +96,6 @@ private:
// Y^2 == X(X^2 + aZ^4) + bZ^6
bool isValidJacobi() const
{
-puts("isValidJacobi");
Fp y2, x2, z2, z4, t;
Fp::sqr(x2, x);
Fp::sqr(y2, y);
@@ -110,17 +109,16 @@ puts("isValidJacobi");
t += z4;
return y2 == t;
}
- // (Y^2 - bZ^2)Z = X^2(X + aZ)
+ // (Y^2 - bZ^2)Z = X(X^2 + aZ^2)
bool isValidProj() const
{
-puts("isValidProj");
Fp y2, x2, z2, t;
Fp::sqr(x2, x);
Fp::sqr(y2, y);
Fp::sqr(z2, z);
- Fp::mul(t, a_, z);
- t += x;
- t *= x2;
+ Fp::mul(t, a_, z2);
+ t += x2;
+ t *= x;
z2 *= b_;
y2 -= z2;
y2 *= z;