Skip to content

Commit

Permalink
Fix to_bytes in fips204.py
Browse files Browse the repository at this point in the history
  • Loading branch information
mlindgren committed Sep 12, 2024
1 parent 9eddd2e commit 424c6ec
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions fips204.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ def keygen_internal(self, xi, param=None):
self.__init__(param)
# print('# keygen_internal()', param)
# print('# seed:', xi.hex())
se = self.h(xi + self.k.to_bytes() + self.ell.to_bytes(), 128)
se = self.h(xi + self.integer_to_bytes(self.k, 1) + self.integer_to_bytes(self.ell, 1), 128)
rho = se[0:32]
rhop = se[32:96]
kk = se[96:128]
Expand Down Expand Up @@ -659,7 +659,7 @@ def expand_a(self, rho):
a = [ [None]*self.ell for _ in range(self.k) ]
for r in range(self.k):
for s in range(self.ell):
rhop = rho + s.to_bytes() + r.to_bytes()
rhop = rho + self.integer_to_bytes(s, 1) + self.integer_to_bytes(r, 1)
a[r][s] = self.rej_ntt_poly(rhop)
return a

Expand Down

0 comments on commit 424c6ec

Please sign in to comment.