aboutsummaryrefslogtreecommitdiff
path: root/pyecsca/ec/point.py
diff options
context:
space:
mode:
Diffstat (limited to 'pyecsca/ec/point.py')
-rw-r--r--pyecsca/ec/point.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/pyecsca/ec/point.py b/pyecsca/ec/point.py
index f20d5e0..fe515ae 100644
--- a/pyecsca/ec/point.py
+++ b/pyecsca/ec/point.py
@@ -97,6 +97,12 @@ class Point(object):
return False
return self.to_affine() == other.to_affine()
+ def __bytes__(self):
+ res = b"\x04"
+ for k in sorted(self.coords.keys()):
+ res += bytes(self.coords[k])
+ return res
+
def __eq__(self, other):
if not isinstance(other, Point):
return False
@@ -133,6 +139,9 @@ class InfinityPoint(Point):
def equals(self, other) -> bool:
return self == other
+ def __bytes__(self):
+ return b"\x00"
+
def __eq__(self, other):
if type(other) is not InfinityPoint:
return False