Skip to content

fix(curves): correct nb_scalar_bits calculation in WeierstrassParameters#463

Merged
eigmax merged 2 commits intoProjectZKM:pre-release-v1.2.5from
eeemmmmmm:fix/weierstrass-scalar-bits
Mar 6, 2026
Merged

fix(curves): correct nb_scalar_bits calculation in WeierstrassParameters#463
eigmax merged 2 commits intoProjectZKM:pre-release-v1.2.5from
eeemmmmmm:fix/weierstrass-scalar-bits

Conversation

@eeemmmmmm
Copy link
Contributor

Fixed wrong multiplier in nb_scalar_bits() for Weierstrass curves.

Was: NB_LIMBS * 16 = 512 bits
Now: NB_LIMBS * NB_BITS_PER_LIMB = 256 bits

This bug was inherited from SP1 (same issue exists in upstream). The code worked correctly but performed 2x unnecessary iterations in scalar multiplication (256 extra double operations with zero bits).

@eeemmmmmm eeemmmmmm requested a review from eigmax March 3, 2026 09:14
@eigmax eigmax changed the base branch from main to pre-release-v1.2.5 March 6, 2026 16:01
@eigmax eigmax merged commit 3c07ecf into ProjectZKM:pre-release-v1.2.5 Mar 6, 2026
3 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