Skip to content

Conversation

@sashass1315
Copy link
Contributor

The From<&NonZeroScalar<C>> for ScalarValue<C> implementation was converting through a byte representation: to_repr -> from_bytes, which performs unnecessary encode-decode-validate steps.

Since CurveArithmetic::Scalar already has Into<ScalarValue<Self>> bound, use it directly instead: scalar.scalar.into(). This removes the intermediate FieldBytes round-trip and redundant range check.

before:
image

after:
image

@tarcieri tarcieri merged commit 6514b1f into RustCrypto:master Feb 10, 2026
15 checks passed
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