Skip to content

3 Bugs on general ECC calculation #343

Closed
@caoweiquan322

Description

@caoweiquan322

Here I construct a ECC $y^2 = x^3 + x + 1 mod 23$ . And starting from point $(9, 7)$. Here are three bugs I found. Any body who is intreated can reproduce the bugs easily.

from ecdsa.ellipticcurve import CurveFp, Point, PointJacobi


if __name__ == '__main__':
    curve = CurveFp(23, 1, 1)
    G = PointJacobi(curve, 9, 7, 1)
    G_affine = G.to_affine()
    print('14*G+G==15*G:', 14*G + G == 15*G)  # Bug1: 14*G + G != 15*G !!!
    print('14*G+G==15*G:', 14*G_affine + G_affine == 15*G_affine)
    G_27 = 27*G  # Bug2: This results in a negative y coordinate.
    print('G_27: (%d, %d)' % (G_27.x(), G_27.y()))
    G_affine_27 = 27*G_affine  # Bug3: This raises an exception.
    print('G_affine_27: (%d, %d)' % (G_affine_27.x(), G_affine_27.y()))

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions