-
Notifications
You must be signed in to change notification settings - Fork 256
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
Add field square root algorithms Shanks, Atkin, and Kong #579
base: master
Are you sure you want to change the base?
Conversation
3f934d1
to
5d5cfa9
Compare
fn kong<F: crate::Field>( | ||
elem: &F, | ||
trace: &F, | ||
c: &F, |
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 didn't know if this variable had a name
}, | ||
/// In the case of 3 mod 4, we can find the square root via an exponentiation, | ||
/// sqrt(a) = a^(p+1)/4. This can be proved using Euler's criterion, a^(p-1)/2 = 1 mod p. | ||
PowerCase3Mod4 { |
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.
Didn't find any name for this algorithm so I just called it "power"
Co-authored-by: Pratyush Mishra <pratyushmishra@berkeley.edu>
cbaa0b7
to
06b51ff
Compare
/// * First factor _q - 1 = 2^s t_ where _t_ is odd. | ||
/// * `two_adicity` - _s_. | ||
/// * `quadratic_nonresidue_to_trace` - _c^t_, with random _c_ such that _c^2^(s - 1) = 1_. | ||
/// * `trace_of_modulus_minus_one_div_two` - _(t - 1)/2_. | ||
TonelliShanks { | ||
two_adicity: u32, | ||
quadratic_nonresidue_to_trace: F, | ||
trace_of_modulus_minus_one_div_two: &'static [u64], |
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.
Just realized my naming is a bit inconsistent with some existing names, this says modulus but I say characteristic. I feel like "characteristic" is more accurate though. Let me know if you think that should be changed.
Hello! I've been doing some work trying to get the algorithms @alexander-zw implemented to actually be called during sqrt calls on the fields - so far they are implemented, but never called. This is proving very difficult for a couple of reasons that you might have easy solutions to (especially @Pratyush). I'll explain how I view the situation
What is the way to go?
|
Description
closes: #543 (finishes task #1 but not whole issue)
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.
Pending
section inCHANGELOG.md
Files changed
in the GitHub PR explorer