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

Add function analogous to ScalarBaseMult for any Point #28

Open
WernerVasquez opened this issue Jul 9, 2022 · 2 comments
Open

Add function analogous to ScalarBaseMult for any Point #28

WernerVasquez opened this issue Jul 9, 2022 · 2 comments

Comments

@WernerVasquez
Copy link

ScalarBaseMult uses a precomputed table, basepointTable, to speed up multiplications. It precomputes the table once when it is called the first time. Since multiplying the base point by a scalar is so frequent, it makes sense to perform this optimization.

There are other projects out there which frequently reuse other points. Monero is an example. In addition to the base point, it uses H to make Pedersen commitments. Upcoming protocol changes use even more such points.

It would be very helpful if a generic version of ScalarBaseMult existed. Perhaps it could be called ScalarMultPrecompute.

How I see this function working, is it would take a Point and a Scalar as its arguments. It would have a map of all previously precomputed points. It would check if the Point had been already precomputed and if not it would precompute it and add it to the map.

I use your library in a project of mine. While I have been able to do many things merely importing your project (and not forking it), this is one thing I cannot do (without forking it).

I would greatly prefer not to fork anything so fundamental as an ed25519 library.

@WernerVasquez
Copy link
Author

I have written example code here

https://gist.github.com/WernerVasquez/c6f72fcb592042a287c76aec540a3bb0

This includes two ways to use the concept, one is a bit slower but may be useful

@WernerVasquez
Copy link
Author

I have implemented these changes here:

https://github.com/WernerVasquez/edwards25519/tree/Additional_Precompute_Capability

I think it has improved the package overall.

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

No branches or pull requests

1 participant