Last active
July 14, 2020 18:31
-
-
Save tscholl2/666ed35603c3813d29c61e7a67e37639 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def cm_method(q,t): | |
""" | |
Given a prime power q and integer t with |t| <= 2sqrt(q), | |
returns an Elliptic curve over GF(q) with q + 1 - t points. | |
""" | |
n = q + 1 - t | |
d = t^2 - 4*q | |
K = QuadraticField(d) | |
j = K.hilbert_class_polynomial().any_root() | |
E = EllipticCurve_from_j(GF(q)(j)) | |
while E.count_points() != n: | |
if d == -3: | |
E = E.sextic_twist(randint(1,q-1)) | |
elif d == -4: | |
E = E.quartic_twist(randint(1,q-1)) | |
else: | |
E = E.quadratic_twist() | |
return E |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment