我的问题是在SageMath或Python中实现小步大步或Pollard Rho,以便为给定的P生成G的一个小乘数x,使得P=x*G。
这是一个较大项目的作业部分。
modi = 115792089237316195423570985008687907853269984665640564039457584007908834671663
E=EllipticCurve(GF(modi), [0,7])
G=E(55066263022277343669578718895168534326250603453777594175500187360389116729240, 32670510020758816978083085130507043184471273380659243275938904335757337482424)
P=E(69335761065767984070318781108127416310968753866933119760392423089576366173459, 113425617697416972613102767146321902225172329004525144463444008550345431352693)x=24734216105351567
搜索应该限制在x的2^54点的空间内,并求解P=x*G,保留上面的所有其他参数。
我尝试了https://github.com/qubd/mini_ecdsa,但我得到了下面的错误。
>>>C = CurveOverFp(0, 0, 7, 2**256-2**32-2**9-2**8-2**7-2**6-2**4-1)
y^2 = x^3 + 7 over F_115792089237316195423570985008687907853269984665640564039457584007908834671663
>>> P = Point(55066263022277343669578718895168534326250603453777594175500187360389116729240,
... 32670510020758816978083085130507043184471273380659243275938904335757337482424)
>>> n = 2^54
>>> Q = (69335761065767984070318781108127416310968753866933119760392423089576366173459, 113425617697416972613102767146321902225172329004525144463444008550345431352693)
>>>crack_baby_giant(C, P, n, Q)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "mini_ecdsa.py", line 470, in crack_baby_giant
R = curve.add(Q, curve.invert(curve.mult(P, g*m)))
File "mini_ecdsa.py", line 321, in add
y_diff = (P_2.y - P_1.y) % self.char
AttributeError: 'tuple' object has no attribute 'y'发布于 2019-07-06 08:45:33
您正在尝试仅对Q使用元组。但是,如果需要Point,这是行不通的,正如Github链接上的文档所指出的那样。试着做Q = Point(... , ...),希望能行得通。
顺便说一句,你可能应该自己实现它,而不是使用其他代码-或者这是作为示例提供的吗?祝好运。
https://stackoverflow.com/questions/56908044
复制相似问题