wraithx on Sun, 22 Jan 2017 21:03:39 +0100


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Question on elliptic curve group orders...


Hello all,

I have some code that should work in Sage, but I don't have that installed. I do have pari/gp installed. Can someone help me convert the following code so that I can run it in pari/gp?

def FindGroupOrder(p,s):
   K = GF(p)
   v = K(4*s)
   u = K(s^2-5)
   x = u^3
   b = 4*x*v
   a = (v-u)^3*(3*u+v)
   A = a/b-2
   x = x/v^3
   b = x^3 + A*x^2 + x
   E = EllipticCurve(K,[0,b*A,0,b^2,0])
   return factor(E.cardinality())

def FindGroupOrderA(p,A):
   K = GF(p)
   d = K((A+2)/4)
   a = K(4*d-2)
   b = K(16*d+2)
   E = EllipticCurve(K,[0,a/b,0,1/b^2,0])
   return factor(E.cardinality())

# for parameter sigma = 1:s
def FindGroupOrderParam1(p,s):
   return FindGroupOrderA (p, 4*s^2/2^64-2)

# for parameter sigma = 2:s
def FindGroupOrderParam2(p,s):
   K = GF(p)
   E = EllipticCurve(K,[0,36])
   P = s*E(-3,3)
   x,y = P.xy()
   x3 = (3*x+y+6)/(2*(y-3))
   A = -(3*x3^4+6*x3^2-1)/(4*x3^3)
   d = K((A+2)/4)
   a = K(4*d-2)
   b = K(16*d+2)
   E = EllipticCurve(K,[0,a/b,0,1/b^2,0])
   return factor(E.cardinality())

# for parameter sigma = 3:s
def FindGroupOrderParam3(p,s):
   K = GF(p)
   d = K(s/2^32)
   A = 4*d-2
   B = 4*A+10
   E = EllipticCurve(K,[0,A/B,0,1/B^2,0])
   return factor(E.cardinality())

Thank you for any help anyone can provide.

-David C.