Point_addition_jacobi.txt 1.04 KB
Newer Older
Aaisha Ghodekar's avatar
Aaisha Ghodekar committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
def Pointaddition_Jacobi(x1,y1,z1,x2,y2,z2,PRECISION):

x1_poly = str_to_poly(x1)
y1_poly = str_to_poly(y1)
z1_poly = str_to_poly(b1)
x2_poly = str_to_poly(x2)
y2_poly = str_to_poly(y2)
z2_poly = str_to_poly(z2)

print 'x1_poly=',x1_poly
print 'y1_poly=',y1_poly
print 'z1_poly=',z1_poly

print 'x2_poly=',x2_poly
print 'y2_poly=',y2_poly
print 'z2_poly=',z2_poly


o1_poly = z1_poly * z1_poly
b_poly = x2_poly * o1_poly
d_poly = y2_poly * o1_poly * z1_poly

e_poly = x1_poly + b_poly
f_poly = y1_poly + d_poly
z3_poly = e_poly * z1_poly

h_poly = f_poly * x2_poly + z3_poly * y2_poly
i_poly = f_poly + z3_poly
g_poly = e_poly + z1_poly

x3_poly = a_poly * g_poly + f_poly * i_poly + e_poly * e_poly * e_poly
y3_poly = i_poly * x3_poly  + g_poly * h_poly


print 'x3=',poly_to_str(x3_poly)
print 'y3=',poly_to_str(y3_poly)
print 'z3=',poly_to_str(z3_poly)


#formulas:
      #O1 = Z12
      #B = X2*O1
      #D = Y2*O1*Z1
      #E = X1+B
      #F = Y1+D
      #Z3 = E*Z1
      #H = F*X2+Z3*Y2
      #I = F+Z3
      #G = Z32
      #X3 = a2*G+F*I+E*E2
      #Y3 = I*X3+G*H