Jump to content

Elliptic curve arithmetic: Difference between revisions

m
→‎{{header|Sage}}: updated to work with Python 3
(OCaml implementation)
m (→‎{{header|Sage}}: updated to work with Python 3)
Line 1,932:
=={{header|Sage}}==
Examples from C, using the built-in Elliptic curves library.
<lang sage>Ellie = EllipticCurve(RR,[0,7]) # RR = field of real numbers
<lang sage>
Ellie = EllipticCurve(RR,[0,7]) # RR = field of real numbers
 
# a point (x,y) on Ellie, given y
Line 1,942 ⟶ 1,941:
return P
 
print (Ellie)
P = point(1)
print ('P',P)
Q = point(2)
print ('Q',Q)
S = P+Q
print ('S = P + Q',S)
print ('P+Q-S', P+Q-S)
print ('P*12345' ,P*12345)</lang>
 
</lang>
{{out}}
<pre>
2,747

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.