Skip to content

use readTwoBigInts helper in signatureNormalizeS and signatureFlipS - #47

Closed
vishalchangrani wants to merge 1 commit into
bastian/improvementsfrom
vishal/bastian/improvements
Closed

use readTwoBigInts helper in signatureNormalizeS and signatureFlipS#47
vishalchangrani wants to merge 1 commit into
bastian/improvementsfrom
vishal/bastian/improvements

Conversation

@vishalchangrani

Copy link
Copy Markdown
Contributor

Summary

  • Small consistency nit spotted while reviewing Go 1.26 support #44 / Fix ECDSA edge cases and harden new implementation #46.
  • signatureNormalizeS (and the test-only signatureFlipS) read S out of the signature buffer with a raw new(big.Int).SetBytes(sig[nLen:]) call, while the rest of the ECDSA code uses the readTwoBigInts helper for the same job.
  • Switch both call sites to _, s := readTwoBigInts(sig, nLen) so the (R, S) parsing pattern is uniform across the package.

Stacked on top of #46 (which is stacked on top of #44).

Test plan

  • CGO_ENABLED=1 go build ./...
  • CGO_ENABLED=1 go test -run 'TestECDSA|TestSignatureFormatCheck' -count=1 ./...

🤖 Generated with Claude Code

Replace direct big.Int.SetBytes calls with the readTwoBigInts helper
for consistency with the rest of the ECDSA code that reads (R, S)
components from a serialized signature.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Comment thread ecdsa.go
@turbolent turbolent closed this Aug 11, 2026
@turbolent
turbolent deleted the vishal/bastian/improvements branch August 11, 2026 18:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants