miracl / MIRACL

MIRACL Cryptographic SDK: Multiprecision Integer and Rational Arithmetic Cryptographic Library is a C software library that is widely regarded by developers as the gold standard open source SDK for elliptic curve cryptography (ECC).
https://miracl.com
653 stars 242 forks source link

not able to call Ecn function in Ecn.h using two values #41

Open urbi001 opened 7 years ago

urbi001 commented 7 years ago

Hi, I am new in C++. I am trying to call Ecn function (public) function given below, in Ecn.h using two Big points and when i am doing that I am getting infinity as answer public: ECn() {MR_INIT_ECN }

ECn(const Big &x,const Big& y)  {MR_INIT_ECN 
                               epoint_set(x.getbig(),y.getbig(),0,p); }

. While I am trying to call the same Ecn function using only one point shown below as argument it is working. I need resolution to solve this issue.

ifndef MR_SUPPORT_COMPRESSION

ECn(const Big& x,int cb)             {MR_INIT_ECN
                               epoint_set(x.getbig(),x.getbig(),cb,p); }

endif

Let me know if you need any more information.

mcarrickscott commented 7 years ago

Hello,

The point (x,y) must be on the curve, which has the equation y^2=x^3+Ax+B mod p, for some values of A and B that define the curve, and some modulus p.

A random pair (x,y) will almost certainly not be on the curve, and will be rejected (and the point set to Infinity).

If you specify only x, then the correct y can be calculated (half of the time) from the above equation.

If you could let us know the values of A, B, p and x and y, then we might be able to provide more help.

Mike

On Fri, Dec 30, 2016 at 11:22 AM, urbi001 notifications@github.com wrote:

Hi, I am new in C++. I am trying to call Ecn function (public) function given below, in Ecn.h using two Big points and when i am doing that I am getting infinity as answer public: ECn() {MR_INIT_ECN }

ECn(const Big &x,const Big& y) {MR_INIT_ECN epoint_set(x.getbig(),y.getbig(),0,p); }

. While I am trying to call the same Ecn function using only one point shown below as argument it is working. I need resolution to solve this issue.

ifndef MR_SUPPORT_COMPRESSION

ECn(const Big& x,int cb) {MR_INIT_ECN epoint_set(x.getbig(),x.getbig(),cb,p); }

endif

Let me know if you need any more information.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/miracl/MIRACL/issues/41, or mute the thread https://github.com/notifications/unsubscribe-auth/ACm8jkshU-44oJwDPwxzduUesu1720Xgks5rNOlsgaJpZM4LYIoe .