from sage.all import * # Or use SAGE Cell Server https://sagecell.sagemath.org/
from Crypto.Util.number import bytes_to_long
from flag import FLAG

p = Integer(input("Prime number for finite field: "))
j = Integer(input("Desired j-invariant for elliptic curve: "))
assert p.is_prime() and p > 2**256 and p < 2**257, "Your prime number is not good enough."

E = EllipticCurve(GF(p), j=j)
assert not E.is_supersingular(), "You're not off that easy!"

P = E.gens()[0]
Q = bytes_to_long(FLAG)*P

print(E)
print('P = {}\nQ = {}'.format(P, Q))