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 sum-of-products for G1Projective and G2Projective #70

Closed

Conversation

andrewwhitehead
Copy link
Contributor

This code originates in bls12_381_plus and is copied with permission. Written by @mikelodder7

@andrewwhitehead
Copy link
Contributor Author

andrewwhitehead commented Aug 9, 2021

For our use case this can be drastically faster when computing p[0] * s[0] + ... + p[n-1] * s[n-1] where p are G1 points and s are scalars. For example:

  • n = 10: 4.9057 ms vs 259.34 us (94% faster)
  • n = 100: 50.524 ms vs 281.01 us (99% faster)

@tarcieri
Copy link

tarcieri commented Aug 9, 2021

Sidebar: it might be nice to have traits for this in e.g. the group crate.

We had a similar need in the k256 crate: RustCrypto/elliptic-curves#380

Maybe someone can open a tracking issue /cc @fjarri

@mikelodder7
Copy link

I’d be up for that.

@str4d
Copy link
Member

str4d commented Aug 16, 2021

We also have multiexponentiation arithmetic in the halo2 crate, and it definitely seems like a good candidate for making generic in the group crate (in the same way I recently added generic batch-inversion logic to the ff crate).

In the meantime, I'll look at this PR in the next week or two.

@str4d
Copy link
Member

str4d commented Sep 1, 2021

I skimmed over the PR and it looks fine. However, @ebfull and I don't think that we should have an implementation of this here specifically; instead it should go generically into group. I've opened zkcrypto/group#25 for tracking progress on this.

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.

4 participants