Return base field element from commit_ivk()

Co-authored-by: Jack Grigg <jack@electriccoin.co>
This commit is contained in:
therealyingtong 2021-05-11 20:06:32 +08:00
parent fb08eeeb39
commit e0b8fd639a
2 changed files with 3 additions and 2 deletions

View File

@ -44,11 +44,11 @@ def rcm_trapdoor(rand):
# https://zips.z.cash/protocol/nu5.pdf#concreteorchardnotecommit
def commit_ivk(rivk: Scalar, ak: Fp, nk: Fp):
return Scalar(sinsemilla_short_commit(
return sinsemilla_short_commit(
rivk,
b"z.cash: Orchard-CommitIvk",
i2lebsp(L_ORCHARD_BASE, ak.s) + i2lebsp(L_ORCHARD_BASE, nk.s)
).s)
)
def rivk_trapdoor(rand):
return Scalar.random(rand)

View File

@ -229,6 +229,7 @@ class Point(object):
return self.x
def __mul__(self, s):
assert isinstance(s, Scalar)
s = format(s.s, '0256b')
ret = self.ZERO
for c in s: