-
Notifications
You must be signed in to change notification settings - Fork 247
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
Implementation of modulus operator for BigInteger
#761
base: master
Are you sure you want to change the base?
Conversation
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.
Thanks for the PR!
I have a couple of questions. Could you comment on why this implementation seems much longer than, the impl in crypto-bigint
?
Is the algorithm you implement much faster? Or is it handling too many cases (e.g., because it was adapted from num-bigint
which handles variable length?)
Hi, thanks for the comments, and sorry for the delay. Concerning your question. Unfortunately, I haven't known about the Comparing the performance of both algorithms, in Certainly, the previous analysis shows that |
Closes #717.
In this PR, I implemented the modulus operator for
BigInteger
. The implementation is based on "The Art Of Computer Programming" by Donald Knuth, Section 4.3, Algorithm D, with the help and guidance from https://github.com/rust-num/num-bigint/blob/master/src/biguint/division.rs.It's possible that this implementation needs some improvements but we can consider it as a starting point. The tests for the implementation include two parts: one for which I use random generated numbers and the other for which I used fixed constant numbers to test the modulus.