Skip to content

Commit

Permalink
dilithium: useHint: use Poly.Decompose, which might be faster
Browse files Browse the repository at this point in the history
  • Loading branch information
bwesterb committed May 14, 2020
1 parent 21fbd12 commit c8d81f9
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion sign/dilithium/internal/common/poly.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,21 @@ func (p *Poly) MakeHint(p0, p1 *Poly) (pop uint32) {
// Computes corrections to the high bits of the polynomial q according
// to the hints in h and sets p to the corrected high bits. Returns p.
func (p *Poly) UseHint(q, hint *Poly) *Poly {
var q0PlusQ Poly

q.Decompose(&q0PlusQ, p)

for i := 0; i < N; i++ {
p[i] = useHint(q[i], hint[i])
if hint[i] == 0 {
continue
}
if q0PlusQ[i] > Q {
p[i] = (p[i] + 1) & 15
} else {
p[i] = (p[i] - 1) & 15
}
}

return p
}

Expand Down

0 comments on commit c8d81f9

Please sign in to comment.