-
Notifications
You must be signed in to change notification settings - Fork 20.8k
Add Baby-Step Giant-Step (BSGS) Discrete Logarithm Algorithm #7118
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
base: master
Are you sure you want to change the base?
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please add a test case with m being not prime. E.g. a=2 b=8 m=9 => x=3 ? @rajucreate
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