Explicitly check Points against None
This commit is contained in:
parent
73b8401b9a
commit
196c317d89
|
@ -23,7 +23,7 @@ def group_hash(D, M):
|
|||
digest.update(URS)
|
||||
digest.update(M)
|
||||
p = Point.from_bytes(digest.digest())
|
||||
if not p:
|
||||
if p is None:
|
||||
return None
|
||||
q = p * JUBJUB_COFACTOR
|
||||
if q == Point.ZERO:
|
||||
|
@ -34,7 +34,7 @@ def find_group_hash(D, M):
|
|||
i = 0
|
||||
while True:
|
||||
p = group_hash(D, M + bytes([i]))
|
||||
if p:
|
||||
if p is not None:
|
||||
return p
|
||||
i += 1
|
||||
assert i < 256
|
||||
|
|
|
@ -147,7 +147,7 @@ class Point(object):
|
|||
while True:
|
||||
data = rand.b(32)
|
||||
p = Point.from_bytes(data)
|
||||
if p:
|
||||
if p is not None:
|
||||
return p
|
||||
|
||||
@staticmethod
|
||||
|
@ -164,7 +164,7 @@ class Point(object):
|
|||
u2 = (vv - Fq.ONE) / (vv * JUBJUB_D - JUBJUB_A)
|
||||
|
||||
u = u2.sqrt()
|
||||
if not u:
|
||||
if u is None:
|
||||
return None
|
||||
|
||||
if u.s % 2 != u_sign:
|
||||
|
|
Loading…
Reference in New Issue