Add Baby-Step Giant-Step (BSGS) Discrete Logarithm Algorithm#7118
Add Baby-Step Giant-Step (BSGS) Discrete Logarithm Algorithm#7118rajucreate wants to merge 12 commits intoTheAlgorithms:masterfrom
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #7118 +/- ##
============================================
+ Coverage 78.51% 78.53% +0.01%
- Complexity 6752 6760 +8
============================================
Files 759 760 +1
Lines 22402 22429 +27
Branches 4400 4406 +6
============================================
+ Hits 17589 17614 +25
- Misses 4108 4110 +2
Partials 705 705 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Could you please add a test case with m being not prime. E.g. a=2 b=8 m=9 => x=3 ? @rajucreate
|
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contribution! |
|
Please reopen this pull request once you have made the required changes. If you need help, feel free to ask in our Discord server or ping one of the maintainers here. Thank you for your contribution! |
Summary
This PR adds the Baby-Step Giant-Step (BSGS) algorithm for solving the discrete logarithm problem:
Find x such that:
a^x ≡ b (mod m)
This algorithm is widely used in number theory and cryptography and runs in O(√m) time.
What’s Included
i) Added full implementation:
ii) Added JUnit tests:
iii) Added entry in DIRECTORY.md under the maths section
iv) Includes detailed Javadoc and follows repository coding conventions
Algorithm Overview
clang-format -i --style=file path/to/your/file.java