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

Constant-time GCD #227

Closed
fjarri opened this issue May 6, 2023 · 4 comments
Closed

Constant-time GCD #227

fjarri opened this issue May 6, 2023 · 4 comments

Comments

@fjarri
Copy link
Contributor

fjarri commented May 6, 2023

There is already an item for that in #1, but I would like to make a separate issue to add more info, and to make it more noticeable. It is likely I will have a go at it the next time I have free time available, in which case I will assign myself to the issue; before that it's free for the taking.

So the state of the art seems to be:

Additionally, with the GCD available, it seems straightforward to implement Jacobi symbol and modular inversion based on it. The latter may supersede the existing inv_odd_mod_bounded(), which was ported from GMP and therefore lacks any comments or references explaining the algorithm.

@tarcieri
Copy link
Member

tarcieri commented May 6, 2023

FWIW, all of the fiat-crypto generated field implementations in the https://github.com/rustcrypto/elliptic-curves repo use Bernstein-Yang inversions

@mratsim
Copy link

mratsim commented Aug 30, 2023

See implementation in Rust: privacy-scaling-explorations/halo2curves#83

@tarcieri
Copy link
Member

tarcieri commented Dec 3, 2023

#372 added an initial implementation of Bernstein-Yang, but currently providing modular inversions only (and not fully wired up to the existing inversion APIs yet).

Constant-time GCD can be implemented in terms of its "divstep" function.

@tarcieri
Copy link
Member

#472 implements GCD using Bernstein-Yang

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

3 participants