Skip to content

Commit

Permalink
fix: leftpad intermediate xored hashes in expandMsgXmd
Browse files Browse the repository at this point in the history
  • Loading branch information
kevincharm committed Feb 11, 2024
1 parent 16afcee commit ea10cf7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pairing/bn254/point.go
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ func expandMsgXmd(domain, msg []byte, outlen int) []byte {
b[0] = new(big.Int).SetBytes(keccak256(b0_input.Bytes()))
for i := 1; i < ell; i++ {
bi_input := bytes.NewBuffer(make([]byte, 0, 32+1+DST_prime.Len()))
bi_input.Write(new(big.Int).Set(msg_prime).Xor(msg_prime, b[i-1]).Bytes())
bi_input.Write(zeroPadBytes(new(big.Int).Set(msg_prime).Xor(msg_prime, b[i-1]).Bytes(), 32))
bi_input.WriteByte(byte(i + 1))
bi_input.Write(DST_prime.Bytes())
b[i] = new(big.Int).SetBytes(keccak256(bi_input.Bytes()))
Expand Down

0 comments on commit ea10cf7

Please sign in to comment.