Inversion and point subtraction on Elliptic Curve

1.2k views Asked by At

I'm trying to implement an authentication protocol based on elliptic curve over prime field in Matlab. I have already done the point addition and point multiplication successfully, but I'm facing a problem while computing the following steps: (Capital letters are points on the curve, small letters are integer scalars)

((y^-1)T4-T2)(rs^-1) = x1P

((y^-1)T5-x1T3)(rs^-1) = X2

Should I compute

y^-1

as

ModInverse(y , prime)? % the multiplicative inverse of y mod prime

Also, is that how I'm supposed to do the subtraction?

nT2 = T2;
nT2{2} = mod(-nT2{2}, prime);

(Negate the y-coordinate of a point) mod prime, and then do the addition on nT2 and another point

1

There are 1 answers

0
Manjula Raja On

I can help you in finding negative co-ordinate of y. I am explaining with a toy example:

sum = [673 146] % Now to convert 2nd element of sum which is the y coordinate, do the following.

sum(1,2) = -sum(1,2) % this will negate the 2nd element of 1st row of sum and store the result into sum. % now to perform subtraction, do the following. Assume that your addend is N1 = [ 6,5] and augend is the sum, therefore, the difference of these two is...

difference = addell(N1,sum,a,b,p) % where a,b and p are parameters of the ECC. %Thaat is a and b are constants and p is the prime modulus of the ECC. For example of an ECC is y^2=x^3+a*x +b mod p

Hope this will suffice your 2nd question.