Skip to content

Instantly share code, notes, and snippets.

@mratsim
Forked from UnitylChaos/alt bn128 Sage Code
Created June 3, 2020 21:43
Show Gist options
  • Save mratsim/128b1aa7e3634cde96722964fb74ff15 to your computer and use it in GitHub Desktop.
Save mratsim/128b1aa7e3634cde96722964fb74ff15 to your computer and use it in GitHub Desktop.
F1 = GF(21888242871839275222246405745257275088696311157297823662689037894645226208583)
G1 = EllipticCurve(F1,[0,3])
print(G1)
P1 = G1(1,2)
F2 = GF(21888242871839275222246405745257275088696311157297823662689037894645226208583^2,"i",modulus=x^2 + 1)
TwistB = 3*F2("9+i")^(-1)
G2 = EllipticCurve(F2,[0,TwistB])
print(G2)
P2x = F2("11559732032986387107991004021392285783925812861821192530917403151452391805634*i + 10857046999023057135944570762232829481370756359578518086990519993285655852781")
P2y = F2("4082367875863433681332203403145435568316851327593401208105741076214120093531*i + 8495653923123431417604973247489272438418190587263600148770280649306958101930")
P2 = G2(P2x,P2y)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment