add getWeierstrass

dev
MITSUNARI Shigeo 8 years ago
parent 30a6c4a6af
commit 3420764006
  1. 10
      include/mcl/ec.hpp

@ -670,14 +670,18 @@ public:
{
compressedExpression_ = compressedExpression;
}
static inline void getYfromX(Fp& y, const Fp& x, bool isYodd)
static inline void getWeierstrass(Fp& yy, const Fp& x)
{
Fp t;
Fp::sqr(t, x);
t += a_;
t *= x;
t += b_;
Fp::squareRoot(y, t);
Fp::add(yy, t, b_);
}
static inline void getYfromX(Fp& y, const Fp& x, bool isYodd)
{
getWeierstrass(y, x);
if (!Fp::squareRoot(y, y)) throw cybozu::Exception("EcT:getYfromX") << x << isYodd;
if (y.isOdd() ^ isYodd) {
Fp::neg(y, y);
}

Loading…
Cancel
Save