虎符2021
·106 words·1 min
学到hin多
学妹改了一个能用的代码,可惜细节部分没处理好
首先用
https://ami.uni-eszterhazy.hu/uploads/papers/finalpdf/AMI_43_from29to41.pdf
给出的曲线变换来做曲线的映射,再用后面提到的思路在ecc曲线上找点再映射回原来的曲线验证正负性
文章中提到了范围的证明,这里不做深入
东拼西凑偷了个通解代码来把玩x:
# sage
n = 6
a = (4*n ^ 2+12*n-3)
b = 32*(n+3)
ee = EllipticCurve([0, a, 0, b, 0])
# y2=x3+109x2+224x
def orig(P, N):
x = P[0]
y = P[1]
a = (8*(N+3)-x+y)/(2*(N+3)*(4-x))
b = (8*(N+3)-x-y)/(2*(N+3)*(4-x))
c = (-4*(N+3)-(N+2)*x)/((N+3)*(4-x))
da = denominator(a)
db = denominator(b)
dc = denominator(c)
l = lcm(da, lcm(db, dc))
return [a*l, b*l, c*l]
g = ee.gens()
print(g)
# [(-200 : 680 : 1)]
P = ee(-200, 680)
# P = ee(g)
print(P)
# 只输出一组解
for i in range(1,100):
x,y,z = orig(i*P, n)
if(x>0 and y>0 and z>0):
print(f'x={x}\n, y={y}\n, z={z}\n')
print(f'i = {i}')
break