diff --git a/orchard_pallas.py b/orchard_pallas.py index 109fa1b..40c24da 100644 --- a/orchard_pallas.py +++ b/orchard_pallas.py @@ -182,6 +182,13 @@ class Point(object): else: return self.double() + def checked_incomplete_add(self, a): + assert self != a + assert self != -a + assert self != Point.identity() + assert self != Point.identity() + return self + a + def __sub__(self, a): return (-a) + self diff --git a/orchard_sinsemilla.py b/orchard_sinsemilla.py index 054d4a0..e76224d 100755 --- a/orchard_sinsemilla.py +++ b/orchard_sinsemilla.py @@ -155,11 +155,11 @@ def sinsemilla_hash_to_point(d, m): n = cldiv(m.len, SINSEMILLA_K) m = pad(n, m) acc = group_hash(b"z.cash:SinsemillaQ", d) - #print("acc", acc) for m_i in m: - acc = acc + group_hash(b"z.cash:SinsemillaS", i2leosp(32, m_i)) + acc - #print("acc", acc) + acc = acc.checked_incomplete_add( + group_hash(b"z.cash:SinsemillaS", i2leosp(32, m_i)) + ).checked_incomplete_add(acc) return acc