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

feat: added a few algorithms that will be used for rewriting RSA algorithm that currently fails the tests #288

Merged
merged 9 commits into from
Mar 8, 2021

Conversation

tjgurwara99
Copy link
Member

@tjgurwara99 tjgurwara99 commented Mar 4, 2021

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:

  1. The Gcd algorithm in math/gcd package - I changed the name of this to Recursive because when we call it from the outside, it will appear as gcd.Recursive which is easier to read (when reviewing) than the gcd.GcdRecursive.
  2. Added another Gcd Algorithm which works iteratively within the same package math/gcd called Iteratively . I've added a benchmark for it as well so people can see why this is faster than the Recursive one.
  3. Added an Lcm algorithm that works using the gcd.Iterative in its parent directory - notice the import call.
  4. Added Miller Rabin Primality Test, which is used inside the RSA algorithm for testing probable primes. This is almost identical to the one I wrote in the TheAlgorithms/C-Plus-Plus repository but of course written in Go.
  5. Changed the name of the package of primecheck to prime 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.

@tjgurwara99 tjgurwara99 changed the title feat: added a few algorithms that will be used for RSA algorithm that currently fails the tests feat: added a few algorithms that will be used for rewriting RSA algorithm that currently fails the tests Mar 4, 2021
@tjgurwara99 tjgurwara99 closed this Mar 8, 2021
@tjgurwara99 tjgurwara99 reopened this Mar 8, 2021
@cclauss cclauss merged commit 8bc4e86 into TheAlgorithms:master Mar 8, 2021
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.

Fix the failing rsa tests
2 participants