Skip to content

Conversation

@polasisubash
Copy link

Description

Added a new class ElGamalCipher.java implementing the ElGamal encryption and decryption algorithm.

Features

  • Implements ElGamal public-key encryption system
  • Supports key generation using modular arithmetic
  • Includes methods for encryption and decryption
  • Demonstrates successful decryption of encrypted messages

Example Output

Original: 12345
Encrypted: (c1, c2 values)
Decrypted: 12345

Technical Notes

  • Implemented under src/main/java/com/thealgorithms/ciphers/
  • Successfully compiled and tested locally using Maven (BUILD SUCCESS)
  • Compatible with Java 21
  • Code adheres to the project’s structure and conventions

References

  • Fixes issue: #13580
  • Algorithm based on ElGamal public-key cryptography principles

Checklist

  • Code compiles successfully
  • Tests passed locally (BUILD SUCCESS)
  • Follows project style and structure
  • Added clear example output
  • Confirmed correct encryption and decryption results

@polasisubash
Copy link
Author

Hi maintainers 👋,
I’ve implemented the ElGamal encryption and decryption algorithm as described in the feature request (#6934).
The code compiles successfully, passes local tests, and follows project conventions.
Looking forward to your review. Thank you! 🙌

@codecov-commenter
Copy link

codecov-commenter commented Nov 12, 2025

Codecov Report

❌ Patch coverage is 0% with 15 lines in your changes missing coverage. Please review.
✅ Project coverage is 78.29%. Comparing base (98eecb9) to head (99039c6).

Files with missing lines Patch % Lines
.../java/com/thealgorithms/ciphers/ElGamalCipher.java 0.00% 15 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master    #7064      +/-   ##
============================================
- Coverage     78.36%   78.29%   -0.08%     
+ Complexity     6684     6682       -2     
============================================
  Files           755      756       +1     
  Lines         22203    22218      +15     
  Branches       4360     4360              
============================================
- Hits          17400    17396       -4     
- Misses         4105     4121      +16     
- Partials        698      701       +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@polasisubash
Copy link
Author

✅ All checks have passed successfully.
The implementation follows the existing cipher structure and includes key generation, encryption, and decryption for ElGamal.
Kindly review when you get a chance. Thank you!
@DenizAltunkapan @alxkm
Kindly review this PR when possible. All checks have passed ✅

1 similar comment
@polasisubash
Copy link
Author

✅ All checks have passed successfully.
The implementation follows the existing cipher structure and includes key generation, encryption, and decryption for ElGamal.
Kindly review when you get a chance. Thank you!
@DenizAltunkapan @alxkm
Kindly review this PR when possible. All checks have passed ✅

@polasisubash
Copy link
Author

✅ All checks have passed successfully.
The implementation follows the existing cipher structure and includes key generation, encryption, and decryption for ElGamal.
Kindly review when you get a chance. Thank you!
@DenizAltunkapan @alxkm

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.

2 participants