-
Notifications
You must be signed in to change notification settings - Fork 333
crypto: Switch to Jacobian coordinates in ECC #1312
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
Conversation
lib/evmone_precompiles/ecc.hpp
Outdated
| const auto s2 = y2 * z1z1z1; | ||
| const auto h = u2 - u1; | ||
| const auto r = s2 - s1; | ||
| assert(r != 0); // TODO: Untested. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is actually impossible. I will have a follow up PR which detects equal points in more efficient way.
|
Benchmarks: |
rodiazet
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Add one comment
lib/evmone_precompiles/ecc.hpp
Outdated
| z3 = z3 + t0; | ||
| const auto z1z1 = z1 * z1; | ||
| const auto u2 = x2 * z1z1; | ||
| const auto t0 = z1 * z1z1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not z1z1z1 but t0?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I translated this "script": https://www.hyperelliptic.org/EFD/g1p/auto-code/shortw/jacobian/addition/madd.op3. But I'll change it.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1312 +/- ##
==========================================
- Coverage 87.15% 87.13% -0.02%
==========================================
Files 167 167
Lines 24761 24740 -21
Branches 4058 4064 +6
==========================================
- Hits 21581 21558 -23
- Misses 537 538 +1
- Partials 2643 2644 +1
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
Replace using of projective coordinates for elliptic curve point to Jacobian coordinates. Jacobian formulas are faster, easier to use and some of the furmulas are independent of the a parameter of a curve (should be handy for implementing secp256r1).
Replace using of projective coordinates for elliptic curve point to Jacobian coordinates. Jacobian formulas are faster, easier to use and some of the furmulas are independent of the a parameter of a curve (should be handy for implementing secp256r1).