We create finite fields by passing their cardinality
Fp = GF(11)
Fp
Fq = GF(11^2)
Fq
For extension fields, the generator is obtained with the .gen()
function.
z = Fq.gen()
z
z^120
Same thing in one go
K.<t> = GF(next_prime(2^128)^2)
K
Curves over $ℚ$
E = EllipticCurve([-10,10])
E
E.plot()
Cuvers over other fields
F = EllipticCurve(GF(11), [1, 0])
F
F.order()
F.cardinality()
F.points()
P = F.random_point()
P
P.order()
Group structure
F.abelian_group()
g = F.gens()[0]
g
g.order()
Construct an isogeny with given kernel
origin = 6*g
origin
F.point([0,0])
I = F.isogeny(origin)
I
I.rational_maps()
FF = I.codomain()
FF
FF.abelian_group()
FF.plot()
The same example, over the rationals
E = EllipticCurve([1,0])
P = E.lift_x(0)
P
P.order()
J = E.isogeny(P)
EE = J.codomain()
EE
In (very) limited cases, Sage can compute the isogeny given the image curve and the degree
JJ = E.isogeny(None, codomain=EE, degree=2)
J == JJ
Implement the (naive) Diffie-Helman key exchange scheme with elliptic curves.
Choose a prime $p$. Take curves at random over $𝔽_p$ until you find one with prime order.
Suggestion: For a start, take $p$ of ~60 bits. When your code works well enough you can try 160 bits (it may take a few minutes to find a curve)
Write a function to sample secret keys, and a function to produce public keys. Perform the key exchnage and verify that Alice and Bob obtain the same key.
Implement Lenstra's factoring method. See the lecture notes, Section 5.
Note: Sage has limited support for curves over $ℤ/Nℤ$, just enough to implement ECM.
Implement the Couveignes-Lercier method for generating irreducible polynomials. See the lecture notes, Section 8.
Note: Sage has limited support for curves over $ℤ/Nℤ$, just enough to implement ECM.