Skip to content

Commit

Permalink
Merge pull request #55 from kevaundray/kw/fix-hash-to-bls-field
Browse files Browse the repository at this point in the history
Write PolyDegree and Number of polynomials to the buffer
  • Loading branch information
kevaundray authored Nov 18, 2022
2 parents c4dbf02 + 6a58261 commit 0bb217d
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions crypto/kzg/kzg.go
Original file line number Diff line number Diff line change
Expand Up @@ -250,9 +250,17 @@ func HashToBLSField(polys Polynomials, comms KZGCommitmentSequence) (*bls.Fr, er

bytes := make([]byte, 8)
binary.LittleEndian.PutUint64(bytes, uint64(params.FieldElementsPerBlob))
_, err = sha.Write(bytes)
if err != nil {
return nil, err
}

bytes = make([]byte, 8)
binary.LittleEndian.PutUint64(bytes, uint64(len(polys)))
_, err = sha.Write(bytes)
if err != nil {
return nil, err
}

for _, poly := range polys {
for _, fe := range poly {
Expand Down

0 comments on commit 0bb217d

Please sign in to comment.