# point tripling over characteristics three field not getting proper result import time p=(3^151)

F1.<x>=GF(3)[]
F.<a>=GF(3^151,'a',modulus=x^151+2*x^2+1);F.modulus();F

A=1;A
B=(0x1fc4865afe00a9216b0b5fd32c6300c4bed0707ae4072a03e55299f157b);B
E = EllipticCurve(F, (0,A,0,0,B));E
P = E.random_point();#P
Q = E.random_point();#Q
print "\n point1 =",P# P.xy()
print "\n point2 =",Q #Q.xy()
x1 = P
y1 = P
x2 = Q
y2 = Q

#x31=((y1^6)*(A^2*(x1^3+B)^2)^(-1))
#x32=((A*x1^3)*((x1+B)^(-1)))
#X3=(x31-x32);X3
#y31=((y1^9)*((A^3*(x1^3+B)^3))^(-1));y31
#y32=((y1^3)*((x1^3+B)^(-1)));y32
#Y3=(y31-y32)

X3=F(((x1^3+B)^3-(B*x1^3))*((x1+B)^2)^(-1));X3

Y3=F(((y1^9)-((y1^3)*(x1^3+B)^2)*((x1+B)^3)^(-1)));Y3

R=E(X3,Y3);R
#print "\n H = P + Q has the components:\n


after executing the code the error is point are not on the curve. I have written the equation for x3 and y3 by different ways.

edit retag close merge delete

Please edit your post to format the code: select the code and press the 101010 button. Also, what is the source of these formulae?

Paper: Efficient Arithmetic on Elliptic Curves over Fields of Characteristics three

You can vote on answers using the arrows on the left of them, and accept an answer by clicking the checkmark below the arrows; please do this (in general).

Sort by » oldest newest most voted First of all the paper is wrong: the denominator should have $x^3$ instead of $x$. Secondly the parentheses are not placed correctly in your second expression. The following seems to be right:

X3=((x1^3+B)^3-B*x1^3)*(x1^3+B)^(-2)
Y3=(y1^9-y1^3*(x1^3+B)^2)*(x1^3+B)^(-3)

more