sage,ecc,已知kp,k求p

p = 16496037227337470707
a = 2020
b = 0
E = EllipticCurve(GF(p),[a,b]) #建立椭圆曲线E
g1 = E(1,12352989693655963935) #选择一点作为生成元
g2=E(3361984281888091942,9881897088122670838)
g3=(g1-g2)
k=3
kP=g3
# Compute the modular inverse of k
k_inv = inverse_mod(k, E.order())  # This assumes that k is non-zero and coprime to the order of the curve

# Now calculate P
P = k_inv * kP  # This is how you retrieve the original point P
print("Recovered point P:", P)
print(3*P+g2==g1)

还是gpt老师厉害,虽然前两次回答都不靠谱。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值