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

Field optimization #168

Merged
merged 7 commits into from
Jan 1, 2022
Merged

Field optimization #168

merged 7 commits into from
Jan 1, 2022

Conversation

mratsim
Copy link
Owner

@mratsim mratsim commented Jan 1, 2022

This does the following

  1. Significantly improve point deserialization speed of Twisted edwards curves by implementing a generic over any prime, optimal fused sqrt+division. This is significantly faster than litterature p ≡ 5 (mod 8) only optimization uv³(uv⁷)^((p−5)/8) presented in Bernstein et al paper for ED25519.
    image
  2. Implement addition chains for inversion and sqrt of Curve25519. Note, Constantine is needlessly using Montgomery representation for the prime field. Montgomery representation is used to reduce the cost of modular reduction, but pseudo-mersenne primes in the form of 2ᵐ-c have a significantly more efficient more reduction. Modular multiplication cost could be made ~40% cheaper (Finite field computation for moduli of special form #11)
  3. Rework square roots public/private proc, isSquare now uses addition chains (important for BLS12-377 sqrt on Fp2)

@mratsim mratsim merged commit bea798e into master Jan 1, 2022
@mratsim mratsim deleted the field-twistededwards-opt branch January 8, 2022 16:09
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.

1 participant