Skip to content

chore: use EncodedPoint to decode uncompressed public key#2736

Merged
rakita merged 4 commits intobluealloy:mainfrom
kevaundray:kw/secp256r1-sec1-encoding
Jul 23, 2025
Merged

chore: use EncodedPoint to decode uncompressed public key#2736
rakita merged 4 commits intobluealloy:mainfrom
kevaundray:kw/secp256r1-sec1-encoding

Conversation

@kevaundray
Copy link
Contributor

@kevaundray kevaundray commented Jul 19, 2025

Use EncodedPoint to decode the uncompressed public key. EncodedPoint allows us to bypass sec1 encoding and use the 64 bytes public key.

@codspeed-hq
Copy link

codspeed-hq bot commented Jul 19, 2025

CodSpeed Performance Report

Merging #2736 will not alter performance

Comparing kevaundray:kw/secp256r1-sec1-encoding (b2733eb) with main (bd14463)

Summary

✅ 171 untouched benchmarks

@kevaundray
Copy link
Contributor Author

kevaundray commented Jul 19, 2025

PR is failing due to codspeed (unrelated) -- did this initial commit to show its a noop. The next commit applies the relevant changes

@kevaundray kevaundray changed the title chore(experiment): use EncodedPoint to decode uncompressed public key chore: use EncodedPoint to decode uncompressed public key Jul 19, 2025
Comment on lines -65 to -92
// Prepend 0x04 to the public key: uncompressed form
let mut uncompressed_pk = [0u8; 65];
uncompressed_pk[0] = 0x04;
uncompressed_pk[1..].copy_from_slice(pk);
Copy link
Contributor Author

@kevaundray kevaundray Jul 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The 0x04 was because of from_sec1_bytes -- using untagged_bytes means we don't need to do this and can avoid this allocation plus the validation of 0x04 tag

@kevaundray kevaundray marked this pull request as ready for review July 19, 2025 19:53
Copy link
Member

@rakita rakita left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cool

@rakita rakita merged commit f8a8f18 into bluealloy:main Jul 23, 2025
29 checks passed
@github-actions github-actions bot mentioned this pull request Jul 23, 2025
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.

2 participants