import json
proof.all(False)

def points_to_json(P, Q):
    def point_to_json(P):
        return {
            "x" : list(map(int, P.x())),
            "y" : list(map(int, P.y())),
        }
    return {
        "P" : point_to_json(P),
        "Q" : point_to_json(Q),
    }

FLAG = b"crypto{????????????????????????????????????????????}"

# Andre's encryption curve
p = 37 * 2**64 * lcm(range(1, 256)) - 1
F.<i> = GF((p, 2), modulus=[1,0,1])
E = EllipticCurve(F, [0,1])
E.set_order((p+1)**2)

# Generator data
P = E(2754452008418475544762931777380298061286322242088097042789979017337032668335152047250270118628626846112409632316814344852346179989*i + 300888031019145372993855450123312195268855753102882163072967372426589237335996165853668912727448513477444811191182550244111536735, 4048396253042221946332182039831591283289177370092736377609511682595711744157657185583897171948127827836521892887941707373829426385*i + 5574313210012278375687658199880462698154719575075630281638825753946911987283962578905520742770486366773314976292767579688991668535, 1)
Q = E(1914292834750542008365772941838940247194316211832948370075234167086803005671626788818592170824160266813720050022811399854833864570*i + 675917976944321956275103708696442108160242821688340828072457829850507425923003867371226253254729899087222613984510532839645132037, 1353413969699500553835259943514301405386193613479830974260135363453012387178560466458631824224103775101292443946360403995987929735*i + 2642848780435012471695812611372313188888541702956899224702856112971832879700145426992696527731460150858414996112482220450878252755, 1)

ct = []
for b in FLAG:
    s = ZZ(randint(0, 2**64 * b))
    ker = ZZ((p+1) // (2**64 * b)) * (P + s * Q)
    phi = E.isogeny(ker, algorithm="factored")
    ct.append(points_to_json(phi(P), phi(Q)))

with open("output.txt", "w") as f:
    json.dump(ct, f)

