def toAffine(P): if len(P) == 2: return P if len(P) != 3 and len(P) != 5: raise Exception("Representation unsupported for normalization") zi = GFp2.inv(P[2]) xz = GFp2.mul(P[0], zi) yz = GFp2.mul(P[1], zi) return (xz, yz)
def R1toAffine(P): (X, Y, Z, Ta, Tb) = P Zi = GFp2.inv(Z) return (GFp2.mul(X, Zi), GFp2.mul(Y, Zi))