feat: added a few algorithms that will be used for rewriting RSA algorithm that currently fails the tests #288
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes #268
Added a few algorithms that will be useful for me to completely rewrite the RSA algorithm from scratch which is currently failing.
The changes I have made are as follows:
math/gcd
package - I changed the name of this toRecursive
because when we call it from the outside, it will appear asgcd.Recursive
which is easier to read (when reviewing) than thegcd.GcdRecursive
.math/gcd
calledIteratively
. I've added a benchmark for it as well so people can see why this is faster than the Recursive one.Lcm
algorithm that works using thegcd.Iterative
in its parent directory - notice the import call.primecheck
toprime
for better import organisation.Apologies for a big PR but this is so that the repository is better organised - instead of rewriting the same algorithms multiple times, it is better to just include it in the imports unless there is an improvement to the already existing one (which can be shown using the benchmarks and its
b.ReportAlloc()
method). This way the primary concern of the algorithm can be separated from the nitty-gritty details of other small algorithms/functions that are within the algorithm that is being added.