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

FYI-- Likely faster constant time modular inverse #6

Closed
gmaxwell opened this issue May 3, 2021 · 1 comment
Closed

FYI-- Likely faster constant time modular inverse #6

gmaxwell opened this issue May 3, 2021 · 1 comment

Comments

@gmaxwell
Copy link

gmaxwell commented May 3, 2021

I know you're not currently actively developing this (though maybe there is more interest in weird curves now that the GLV patent has expired...), but I thought I'd send you a note-- close the issue when you've seen it. :p

Your existing fermat inverse is super duper fast because you mostly only need to work over the base field and mersenne numbers result in really nice ladders but there is a new approach that could be faster that you might be interested in: See https://github.com/bitcoin-core/secp256k1/blob/master/doc/safegcd_implementation.md which describes the implementation in libsecp256k1 (and links to the safegcd paper that inspired the work).

At 256 bits the speedup over a ladder is enormous, for 2^127-1 I expect it to be faster but it's possible that it wouldn't be. If you're ever interested in trying it out, feel free to drop me a line. It should be trivial to modify our code for your sized numbers (it already works but will waste some time due to working with 256 bit numbers) -- I would have done it just to post benchmarks but that would have required me to figure out how to benchmark your code. :P

@catid
Copy link
Owner

catid commented May 4, 2021

Thanks for the heads up!

@catid catid closed this as completed May 4, 2021
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

2 participants