Skip to content

Add WnafBase::multiscalar_mul again#22

Closed
tarcieri wants to merge 21 commits into
RustCrypto:mainfrom
tarcieri:rustcrypto-multiscalar-mul
Closed

Add WnafBase::multiscalar_mul again#22
tarcieri wants to merge 21 commits into
RustCrypto:mainfrom
tarcieri:rustcrypto-multiscalar-mul

Conversation

@tarcieri
Copy link
Copy Markdown
Member

@tarcieri tarcieri commented Jun 2, 2026

This merges the multiscalar multiplication implementation proposed in zkcrypto#85 into the RustCrypto fork so we can try it out.

Originally added as #14

tarcieri and others added 21 commits February 8, 2026 09:07
This unifies the methods previously exposed by the `PrimeCurveAffine`
and `CofactorCurveAffine` traits. The prime-order and cofactor traits
are now all marker traits, and their affine-specific traits are
automatically derived.
Bump `rand_core` to v0.10; MSRV 1.85
Computes a sum-of-products `aA + bB + ...` in variable time with w-NAF
multi-exponentiation using the interleaved window method, also known
as Straus' method.

The key insight is that when computing this sum by means of additions
and doublings, the doublings can be shared by performing the additions
within an inner loop.

The API and implementation are inspired in part by `curve25519-dalek`,
namely the `VartimeMultiscalarMul` trait and corresponding
implementation in `straus.rs`.

This results in ~28% speedup on `p256` for a 3 scalar/point input:

    ProjectivePoint operations/point-scalar lincomb (variable-time)
        time:   [149.13 µs 149.80 µs 150.84 µs]
        change: [−27.999% −27.645% −27.267%] (p = 0.00 < 0.05)
This is closer to the `VartimeMultiscalarMul` trait in
`curve25519-dalek`.
This merges the multiscalar multiplication implementation proposed in
zkcrypto#85 into the RustCrypto fork so we can try it out.

Originally added as RustCrypto#14
@tarcieri tarcieri closed this Jun 2, 2026
@tarcieri tarcieri deleted the rustcrypto-multiscalar-mul branch June 2, 2026 18:07
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