Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimizing scalar multiplication and exponentiation like algorithms #314

Open
hecmas opened this issue Dec 1, 2023 · 2 comments
Open

Optimizing scalar multiplication and exponentiation like algorithms #314

hecmas opened this issue Dec 1, 2023 · 2 comments
Assignees
Labels
feature new feature to implement zkevm-pil2

Comments

@hecmas
Copy link
Contributor

hecmas commented Dec 1, 2023

Description

Say that we are in a group $(\mathbb{G}, +)$ or prime order $r$. We are given an element $Q \in_R \mathbb{G}$ and we are asked to compute $k\cdot Q$ for some $k_R \in [1, r-1]$.

There are many methods we can use to optimize this operation:

  • Generic methods:

    • Precompute tables that depend on $Q$, when $Q$ is known a priori.
    • Addition chains which are useful when $k$ is fixed.
    • Windowing techniques.
    • Exponent recoding, which replace the binary representation of $k$ with a representation that has fewer non-zero terms. The most optimal of such representations being NAF.
    • Combining the last two, obtaining the optimal wNAF method.
  • Methods particular to elliptic curves:

    • The GLV method, explained in this post.
    • The GLS method.
    • Techniques related to choosing a better underlying field or the elliptic curve, change the point coordinates...

Numbers

Test 1/3:
	Double-and-add style: total time is 14m11.334s
	wNAF method for scalar multiplication with w = 3: total time is 11m59.115s
	GLV method with wNAF double scalar multiplication with w = 3: total time is 13m13.886s

Test 2/3:
	Double-and-add style: total time is 14m10.720s
	wNAF method for scalar multiplication with w = 4: total time is 11m33.297s
	GLV method with wNAF double scalar multiplication with w = 4: total time is 12m35.619s

Test 3/3:
	Double-and-add style: total time is 14m8.215s
	wNAF method for scalar multiplication with w = 5: total time is 11m21.073s
	GLV method with wNAF double scalar multiplication with w = 5: total time is 12m31.586s
@hecmas hecmas added the feature new feature to implement label Dec 1, 2023
@ignasirv
Copy link
Contributor

ignasirv commented Dec 1, 2023

The post access is restricted :)

@hecmas
Copy link
Contributor Author

hecmas commented Dec 1, 2023

The post access is restricted :)

Fixed :)

Warning: Math Heavy

@hecmas hecmas changed the title [Feature]: Optimizing EC scalar point multiplication via GLV Optimizing EC scalar point multiplication via GLV Dec 28, 2023
@hecmas hecmas changed the title Optimizing EC scalar point multiplication via GLV Optimizing scalar multiplication and exponentiation like algorithms Dec 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature new feature to implement zkevm-pil2
Projects
None yet
Development

No branches or pull requests

4 participants