Check for incomplete addition exceptional cases in Sinsemilla
This commit is contained in:
parent
fb45bda972
commit
a2bf6c5a04
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in New Issue