Skip to content

Commit

Permalink
secp256k1: Address some linter complaints.
Browse files Browse the repository at this point in the history
  • Loading branch information
davecgh committed Aug 9, 2024
1 parent 749a2d2 commit 2124b09
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions dcrec/secp256k1/schnorr/signature.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ func schnorrVerify(sig *Signature, hash []byte, pubKey *secp256k1.PublicKey) err
// e = BLAKE-256(r || m) (Ensure r is padded to 32 bytes)
var commitmentInput [scalarSize * 2]byte
sig.r.PutBytesUnchecked(commitmentInput[0:scalarSize])
copy(commitmentInput[scalarSize:], hash[:])
copy(commitmentInput[scalarSize:], hash)
commitment := blake256.Sum256(commitmentInput[:])

// Step 6.
Expand Down Expand Up @@ -293,7 +293,7 @@ func schnorrSign(privKey, nonce *secp256k1.ModNScalar, hash []byte) (*Signature,
// e = BLAKE-256(r || m) (Ensure r is padded to 32 bytes)
var commitmentInput [scalarSize * 2]byte
r.PutBytesUnchecked(commitmentInput[0:scalarSize])
copy(commitmentInput[scalarSize:], hash[:])
copy(commitmentInput[scalarSize:], hash)
commitment := blake256.Sum256(commitmentInput[:])

// Step 8.
Expand Down
2 changes: 1 addition & 1 deletion dcrec/secp256k1/schnorr/signature_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ func TestSchnorrSignAndVerifyRandom(t *testing.T) {
randByte = rng.Intn(len(badHash))
randBit = rng.Intn(7)
badHash[randByte] ^= 1 << randBit
if sig.Verify(badHash[:], pubKey) {
if sig.Verify(badHash, pubKey) {
t.Fatalf("verified signature for bad hash\nsig: %x\nhash: %x\n"+
"pubkey: %x", sig.Serialize(), badHash,
pubKey.SerializeCompressed())
Expand Down

0 comments on commit 2124b09

Please sign in to comment.