Implement __sub__ on Point

pull/9/head
tuxxy 2017-12-27 06:58:43 -07:00
parent f076da6518
commit 337a78851b
No known key found for this signature in database
GPG Key ID: 7BB971A0E89144D9
1 changed files with 6 additions and 0 deletions

View File

@ -108,6 +108,12 @@ class Point(object):
return Point(sum, self.curve_nid, self.group)
def __sub__(self, other):
"""
Performs subtraction by adding the inverse of the `other` to the point.
"""
return (self + (~other))
def __invert__(self):
"""
Performs an EC_POINT_invert on itself.