Created DiffieHellman.java and MonoAlphabetic.java
Description
This PR implements the Diffie-Hellman Key Exchange and MonoAlphabetic Cipher algorithms.
Key Changes:
-
Diffie-Hellman Key Exchange:
- Added
DiffieHellman.javaunder theciphersdirectory. - The implementation allows two users (Person A and Person B) to securely generate a shared secret key over an insecure channel using large prime numbers and modular arithmetic.
- The code prompts the users to input their secret numbers and performs the necessary calculations to exchange and compute the shared secret keys.
- Added
-
MonoAlphabetic Cipher:
- Added
MonoAlphabetic.javaunder theciphersdirectory. - The implementation allows the user to either encrypt or decrypt data using a predefined substitution cipher, where each letter of the alphabet is replaced with a corresponding letter.
- The user is prompted to enter the data, and the cipher is applied to return either the encrypted or decrypted result.
- Added
Both algorithms are utility classes, with private constructors to prevent instantiation and static methods to handle their respective functionalities.
- [x] I have read CONTRIBUTING.md.
- [x] This pull request is all my own work -- I have not plagiarized it.
- [x] All filenames are in PascalCase.
- [x] All functions and variable names follow Java naming conventions.
- [x] All new algorithms have a URL in their comments that points to Wikipedia or other similar explanations.
- [x] All new code is formatted with
clang-format -i --style=file path/to/your/file.java
Codecov Report
:x: Patch coverage is 65.51724% with 10 lines in your changes missing coverage. Please review.
:white_check_mark: Project coverage is 66.97%. Comparing base (5a1f681) to head (338859c).
:warning: Report is 516 commits behind head on master.
Additional details and impacted files
@@ Coverage Diff @@
## master #5508 +/- ##
============================================
- Coverage 66.98% 66.97% -0.01%
- Complexity 4523 4530 +7
============================================
Files 613 615 +2
Lines 16990 17019 +29
Branches 3282 3286 +4
============================================
+ Hits 11380 11398 +18
- Misses 5160 5166 +6
- Partials 450 455 +5
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
:rocket: New features to boost your workflow:
- :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
I am currently unable to build my code due to the outdated pom.xml file. The dependencies required for the JUnit tests are missing, leading to compilation errors. To proceed with testing and building my changes effectively, I recommend updating the pom.xml file to include the necessary JUnit dependencies.
Please let me know if there's a preferred way to address this issue or if I should modify the code to remove the dependencies temporarily.
Thank you!
Did you try to place the tests in the .../src/test/java/com/thealgorithms directory? cf. #5501.
No, I'll try it. Thank you
Hi @vil02, I've addressed all the requested changes and updated the pull request accordingly. Could you please review the latest changes at your convenience and let me know if anything else is needed? Thank you!
@vil02 please review
Hi @vil02, kindly review the changed code.
Hello @vil02 @siriak @alxkm @BamaCharanChhandogi @yanglbme I am participating in Hacktoberfest'25 and request that you kindly check the PR for further merging. Thank you