Skip to content

Commit

Permalink
Remove an unnecessary loop from hashPointToR
Browse files Browse the repository at this point in the history
  • Loading branch information
Stebalien committed Sep 5, 2024
1 parent 6f78267 commit 549526a
Showing 1 changed file with 6 additions and 13 deletions.
19 changes: 6 additions & 13 deletions sign/bdn/bdn.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,23 +32,16 @@ var modulus128 = new(big.Int).Sub(new(big.Int).Lsh(big.NewInt(1), 128), big.NewI
// We also use the entire roster so that the coefficient will vary for the same
// public key used in different roster
func hashPointToR(pubs []kyber.Point) ([]kyber.Scalar, error) {
peers := make([][]byte, len(pubs))
for i, pub := range pubs {
peer, err := pub.MarshalBinary()
if err != nil {
return nil, err
}

peers[i] = peer
}

h, err := blake2s.NewXOF(blake2s.OutputLengthUnknown, nil)
if err != nil {
return nil, err
}

for _, peer := range peers {
_, err := h.Write(peer)
for _, pub := range pubs {
peer, err := pub.MarshalBinary()
if err != nil {
return nil, err
}
_, err = h.Write(peer)
if err != nil {
return nil, err
}
Expand Down

0 comments on commit 549526a

Please sign in to comment.