`Point.double()` gives infinity for a valid point on NIST192p
还没有人认领这个 Issue。
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 62/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- python
- 领域
- cryptography
调研方向
仿射倍点运算是椭圆曲线模块(src/ecdsa/ellipticcurve.py)中的 Point.double(),同一文件中的 PointJacobi 是给出正确结果的参考实现。先复现 issue 中的四行代码片段,然后找到 double() 判定结果为无穷远点的位置,检查该判断使用的是 y 还是斜率。完成标准是:对该点,P.double()、P + P 和 2 * P 返回 (2, p - y),与 PointJacobi 结果一致,并添加一个回归测试,覆盖斜率为零且 y 不为零的情况。
由索引模型根据 Issue 内容生成。
描述
Hi,
I've been using python-ecdsa as a reference while writing some test vectors for my own curve code, and ran into something odd with the affine Point class on NIST192p: doubling this point gives INFINITY.
from ecdsa.curves import NIST192p
from ecdsa.ellipticcurve import Point, PointJacobi
curve = NIST192p.curve
p, a, b = curve.p(), curve.a(), curve.b()
x = p - 1
y = pow(x**3 + a*x + b, (p + 1) // 4, p)
P = Point(curve, x, y) # on the curve, the constructor accepts it
print("P.double()", P.double())
print("P + P ", P + P)
print("2 * P ", 2 * P)
print("Jacobi ", PointJacobi.from_affine(P).double().to_affine())
Output:
P.double() infinity
P + P infinity
2 * P infinity
Jacobi (2,5150145059219101967911223597381767395814993794044679600504)
$y$ isn't 0 here, so the double shouldn't be infinity; it should be $(2,\ p - y)$, which is what PointJacobi gives. P + P and 2 * P are wrong the same way. This is with ecdsa 0.19.2 from pip.
Some potential clues: for this point $3x^2 + a \equiv 0 \pmod{p}$, so the slope in double() is 0 even though $y \neq 0$. I guess the zero slope ends up being treated as the infinity case, which is only right when $y = 0$.
Thank you!
- 主要语言
- Python
- 星标
- 976
- 派生
- 345
- 平均合并
- 26 分钟
- 30 天内合并 PR
- 1
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
tlsfuzzer/python-ecdsa 的其他 Issue
-
难度 4/5 3-5 天 新手友好度 35/100
tlsfuzzer/python-ecdsa#381 · 1 条评论 · 5 个 reaction ·
-
ecdsa.keys.VerifyingKey.verify_digest should fail for CurveEdTw可能已有人在做 @apoorvdarshan 于 139 天前认领。 未关闭bug help wanted
难度 2/5 1-3 小时 新手友好度 45/100
tlsfuzzer/python-ecdsa#349 · 1 条评论 ·
-
feature help wanted
难度 4/5 3-5 天 新手友好度 35/100
tlsfuzzer/python-ecdsa#348 · 1 条评论 ·
-
bug help wanted
难度 3/5 1-2 天 新手友好度 35/100
tlsfuzzer/python-ecdsa#341 · 1 条评论 ·
-
maintenance
难度 5/5 一周以上 新手友好度 25/100
tlsfuzzer/python-ecdsa#340 · 4 条评论 · 1 个 reaction ·
查看 tlsfuzzer/python-ecdsa 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 66/100
维护者通常 1 天内回复
-
bug (unverified)
难度 2/5 1-3 小时 新手友好度 62/100
scikit-hep/awkward#4581 · 1 条评论 ·
维护者通常 1 天内回复
-
ci-cd priority: low
难度 2/5 1-3 小时 新手友好度 75/100
LearningCircuit/local-deep-research#9163 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 85/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 62/100
supersonic-lumina/ENM156#50 ·
维护者通常 2 天内回复