Commit 6514b1f
authored
refactor: eliminate byte round-trip in NonZeroScalar to ScalarValue conversion (#2296)
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:
<img width="958" height="607" alt="image"
src="https://github.com/user-attachments/assets/96d1a926-583d-4c33-af32-2abf393f9170"
/>
after:
<img width="969" height="592" alt="image"
src="https://github.com/user-attachments/assets/9254c2b3-27db-4994-89cc-f99339d86033"
/>1 parent 4e6cca0 commit 6514b1f
1 file changed
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
212 | 212 | | |
213 | 213 | | |
214 | 214 | | |
215 | | - | |
| 215 | + | |
216 | 216 | | |
217 | 217 | | |
218 | 218 | | |
| |||
0 commit comments