Skip to content

Commit d22cd8a

Browse files
42Pupusasclaude
andcommitted
k256: use group crate WnafBase/WnafScalar for GLV vartime mul
Replace custom wNAF implementation (wnaf_128, build_odd_multiples, WnafSlot, wnaf_ladder) with the group crate's WnafBase/WnafScalar types and WnafBase::multiscalar_mul_array. A new WnafScalar::from_le_bytes constructor accepts short (128-bit) GLV half-scalars, producing ~half the wNAF digits and ~half the doublings in the evaluation loop. multiscalar_mul_array avoids the two collect() heap allocations of the iterator-based multiscalar_mul. Depends on RustCrypto/group#15 for the group crate changes (wnaf_table size fix, from_le_bytes, multiscalar_mul_array, pre-sized Vec allocations). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent d559afc commit d22cd8a

3 files changed

Lines changed: 81 additions & 229 deletions

File tree

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,4 @@ primefield = { path = "primefield" }
2828
primeorder = { path = "primeorder" }
2929

3030
elliptic-curve = { git = "http://github.com/RustCrypto/traits.git" }
31-
rustcrypto-group = { git = "https://github.com/RustCrypto/group" }
31+
rustcrypto-group = { git = "https://github.com/42Pupusas/group.git", branch = "wnaf-optimizations" }

0 commit comments

Comments
 (0)