Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'modular inverse does not exist' when doubling a point on the x axis #17

Closed
lc6chang opened this issue Feb 12, 2022 · 0 comments · Fixed by #18
Closed

'modular inverse does not exist' when doubling a point on the x axis #17

lc6chang opened this issue Feb 12, 2022 · 0 comments · Fixed by #18
Assignees
Labels
bug Something isn't working

Comments

@lc6chang
Copy link
Owner

When doubling a point on x axis (i.e. y=0), the expected result is the Point at infinity but now it raises 'modular inverse does not exist' exception.

>>> from ecc.curve import Curve25519
>>> from ecc.curve import Point
>>> P = Point(x=0, y=0, curve=Curve25519)
>>> P + P
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/chang/ecc-pycrypto/ecc/curve.py", line 40, in __add__
    return self.curve.add_point(self, other)
  File "/Users/chang/ecc-pycrypto/ecc/curve.py", line 104, in add_point
    return self._double_point(P)
  File "/Users/chang/ecc-pycrypto/ecc/curve.py", line 255, in _double_point
    s = up * modinv(down, self.p)
  File "/Users/chang/ecc-pycrypto/ecc/math_utils/mod_inverse.py", line 16, in modinv
    raise Exception("modular inverse does not exist")
Exception: modular inverse does not exist
@lc6chang lc6chang added the bug Something isn't working label Feb 12, 2022
@lc6chang lc6chang self-assigned this Feb 12, 2022
@lc6chang lc6chang linked a pull request Feb 12, 2022 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant