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

clean up: MulByV, etc #7

Closed
ggutoski opened this issue Jun 10, 2020 · 0 comments
Closed

clean up: MulByV, etc #7

ggutoski opened this issue Jun 10, 2020 · 0 comments
Assignees
Labels
cleanup Suggestion to clean up the code

Comments

@ggutoski
Copy link
Contributor

Currently all curves of embedding degree 12 (ie. everything except BW6-761) implement (and test!) all six of the methods MulByV, MulByVW, MulByV2W, MulByVWNRInv, MulByV2NRInv, MulByWNRInv even though each curve actually uses only three:

  • BLS12-381 pairing uses only MulByVWNRInv, MulByV2NRInv, MulByWNRInv
  • BLS12-377, BN256 pairings use only MulByVW, MulByV, MulByV2W

These methods appear in e12.go for each curve.
This is bad design. The original purpose was to facilitate automatic generation of known-answer tests in sage---ie. so we can use the same sage script to generate KATs for all degree-twelve field extensions in all curves. (The relevant sage script is pointed to in #6.)

BW6-761 needs its own new trio of methods: MulByVMinusThree, MulByVminusTwo, MulByVminusFive. I don't think we should simply pile these three additional methods on top of the other six. Instead, we should remove these methods from e12.go to pairing.go; each curve should keep only the three methods it needs instead of supporting all of them.

There's no need for KATs for these methods, so we can simply remove them from the sage script to save time. Instead, we can test these methods in pure Go by comparing against the output of Mul. Code will be simpler, tests will be simpler.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cleanup Suggestion to clean up the code
Projects
None yet
Development

No branches or pull requests

1 participant