[英]How to find minimum y coordinate for elliptical curve y^2 = x^3 +
How can I find the minimum y coordinate for elliptical curve y^2 = x^3 + ax + b on a finite field F(p) in SAGE where a and b are large about the order of 10^15 and the integer p is very large about the order of 10^45 ? 如何在SAGE中的有限域F(p)上找到椭圆曲线的最小y坐标y ^ 2 = x ^ 3 + ax + b,其中a和b大约为10 ^ 15的数量且整数p为关于10 ^ 45的订单非常大? I need to find it in SAGE and I have been trying many ways.
我需要在SAGE中找到它并且我一直在尝试很多方法。 I am posting some of my code:
我发布了一些代码:
maxtime=120960000
p = 976324781263478623476912346213469128736427364
a = 783468734639429
b = 98347874287423
E = EllipticCurve(GF(p),[a,b])
length =50
for i in range(1,maxtime):
e = ZZ.random_element(999999999999)
if E.is_x_coord(I) == true:
temp = E.lift_x(I)
break
i=0
print 'P1:'
print temp
length=0
t=50
count=2
p2=temp+temp
while count < 10000000000:
count=count+1
p2=p2+temp
if (p2[1]>0):
if (ZZ(p2[1]) < ZZ(p-1)):
if (p2[0] > 0):
if( ZZ(p2[0]) < ZZ(p-1)):
if E.is_x_coord(p2[0]) == true:
y2 = E.lift_x(p2[0])
length=len(str(y2[1]))
if length <=11:
print 'p2:'
print y2
print 'count:'
print count
break
if t > length:
t= length
print 'length:'
print t
print 'count:'
print count
print 'p2:'
print y2
print 'failed:'
The above is just sample code with random numbers. 以上只是带有随机数的示例代码。 Any suggestions or an entirely different Idea would also be very helpful.
任何建议或完全不同的想法也会非常有帮助。
Thanks a lot JS 非常感谢JS
There is no natural ordering on the elements of GF(p). GF(p)的元素没有自然排序。 By minimum y, I guess you mean by the usual order on the integers.
至少y,我猜你的意思是整数的通常顺序。 Here's an example with p=17, a=11, b=3.
这是一个例子,p = 17,a = 11,b = 3。 Solution is y=3, x=4.
解是y = 3,x = 4。
sage: K = GF(17)
sage: a, b = 11, 3
sage: _.<X> = K[]
sage: P = X^3 + a*X + b
sage: next(((P - y^2).roots(), y) for y in K if (P - y^2).roots())
([(4, 1)], 3)
sage: 3^2 == P(4)
True
Beware that your p
is not prime. 请注意你的
p
不是素数。
The elliptic curve E has at least p+1-2p^{1/2} points and for large p and one has that (p+1-2p^{1/2})/p is almost equal to 1. This means that on average every value of y has one value of x such that (x,y) lies on the elliptic curve. 椭圆曲线E至少有p + 1-2p ^ {1/2}点,对于大p和1,(p + 1-2p ^ {1/2})/ p几乎等于1.这意味着平均而言,y的每个值都有一个x值,使得(x,y)位于椭圆曲线上。 This means that unless there is something strange going on I would expect that the smallest y will be really small (I expect it to be 0,1 or 2 most of the times).
这意味着除非发生奇怪的事情,否则我会期望最小的y会非常小(我希望它大多数时候都是0,1或2)。 This suggest just trying different values of y from small to big will be very fast in practice.
这表明在实践中尝试从小到大的不同y值将是非常快的。 But I have no proof that it will always be very fast, because if indeed something strange is happening and the smallest y is in fact really big it will take very long.
但是我没有证据证明它总是会非常快,因为如果确实发生了一些奇怪的事情并且最小的y实际上非常大,那将需要很长时间。
p = next_prime(976324781263478623476912346213469128736427364)
a = 7834684394239111322316457
b = 98347872833141
E = EllipticCurve(GF(p),[a,b])
Fx.<x> = GF(p)[]
f = x^3 + a*x + b
for y in GF(p):
xs=(f-y^2).roots(multiplicities=False)
if len(xs)>0:
x = xs[0]
P = E(x,y)
print P
break
Gives the point (544771569075032357553369359272826923818637077 : 1 : 1) within 1/10 of a second. 在1/10秒内给出点(544771569075032357553369359272826923818637077:1:1)。
I tried 5000 random values of a and b with the above prime p and below you get to see how often I got which value of y as smallest value. 我尝试了5000个a和b的随机值和上面的素数p以下,你可以看到我多长时间得到y的哪个值作为最小值。 Just to give you some sense on how good this will work in practice.
只是为了让您了解这在实践中有多好。
0 3361
1 1089
2 364
3 119
4 41
5 20
6 3
7 2
8 1
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.