-
Notifications
You must be signed in to change notification settings - Fork 25
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
montgomery arithmetic #23
Conversation
src/field.rs
Outdated
// const MONTY_MU: u32 = 80; | ||
const MONTY_BITS: u32 = 7; | ||
const MONTY_MASK: u32 = (1 << MONTY_BITS) - 1; | ||
const MONTY_MU: u32 = 19; // (-P^-1) mod 2^MONTY_BITS |
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.
Nice work! I think functionally this PR is amazing. My main feedback is i think we should go hard on some comments since we plan to make this a learning resource. If you had to explain to someone what you where doing, who didn't have much prior experience how would you paint the intuition? What intuition made the optimization clique for you? Is there a small example we can include in the comments or another test? Personally i find if i can explain things well it really solidifies my understanding too :)
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.
@0xJepsen added comments and examples for montgomery and barret reduction. Let me know if those are not clearly explained.
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.
this is awesome :) Thanks for adding those! Looks like a test isn't passing
fixed |
closes #16
closes #17
closes #18
It changes the following: