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

Fix sqrt for QuadExtField #358

Merged
merged 6 commits into from
Dec 6, 2021
Merged

Conversation

mmagician
Copy link
Member

@mmagician mmagician commented Dec 5, 2021

Description

Fix for the case when c1 = 0 & c0.legendre.is_qnr()

closes: #344


Before we can merge this PR, please make sure that all the following items have been
checked off. If any of the checklist items are not applicable, please leave them but
write a little note why.

  • Targeted PR against correct branch (master)
  • Linked to GitHub issue with discussion and accepted design OR have an explanation in the PR that describes this work.
  • Wrote unit tests (an accompanying PR to curves)
  • Updated relevant documentation in the code
  • Added a relevant changelog entry to the Pending section in CHANGELOG.md
  • Re-reviewed Files changed in the GitHub PR explorer

mmagician added a commit to w3f/arkworks-algebra that referenced this pull request Dec 6, 2021
@mmagician mmagician merged commit d9719b7 into arkworks-rs:master Dec 6, 2021
@mmagician mmagician deleted the sqrt-testing branch December 6, 2021 11:19
// or we need to compute sqrt(c0/P::NONRESIDUE)
return (self.c0.div(P::NONRESIDUE))
.sqrt()
.map(|res| Self::new(P::BaseField::zero(), res));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if there's a way to precompute P::NONRESIDUE.inverse() here

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One simple solution is to add NONRESIDUE_INV into the trait of the field parameters.

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.

Square root method for quadratic fields does not cover the case when p = 3 mod 4
3 participants