Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Add ElGamalCipher implementing ElGamal encryption and decryption#7064

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
polasisubash wants to merge12 commits intoTheAlgorithms:master
base:master
Choose a base branch
Loading
frompolasisubash:add-elgamal-encryption

Conversation

@polasisubash
Copy link

Description

Added a new classElGamalCipher.java implementing theElGamal 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 undersrc/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 commentedNov 12, 2025
edited
Loading

Codecov Report

❌ Patch coverage is0% with15 lines in your changes missing coverage. Please review.
✅ Project coverage is 78.45%. Comparing base (2c4bf3c) to head (9d421bc).

Files with missing linesPatch %Lines
.../java/com/thealgorithms/ciphers/ElGamalCipher.java0.00%15 Missing⚠️
Additional details and impacted files
@@             Coverage Diff              @@##             master    #7064      +/-   ##============================================- Coverage     78.51%   78.45%   -0.07%  Complexity     6752     6752              ============================================  Files           759      760       +1       Lines         22402    22417      +15       Branches       4400     4400              ============================================- Hits          17589    17587       -2- Misses         4108     4124      +16- Partials        705      706       +1

☔ 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

@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

@DenizAltunkapan
Copy link
Member

@polasisubash Please always add a corresponding test class to your implementation

@DenizAltunkapan
Copy link
Member

@polasisubash
The implementation captures the basic idea of ElGamal, but there are several critical cryptographic issues, such as invalid generator selection, missing key range constraints, and lack of input validation. Additionally, the stateful design and missing documentation/tests do not align with the repository’s standards, so the code needs refactoring before it can be merged.

Also don't forget the corresponding test class!

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@DenizAltunkapanDenizAltunkapanAwaiting requested review from DenizAltunkapanDenizAltunkapan is a code owner

@yanglbmeyanglbmeAwaiting requested review from yanglbmeyanglbme is a code owner

@alxkmalxkmAwaiting requested review from alxkmalxkm is a code owner

At least 1 approving review is required to merge this pull request.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

3 participants

@polasisubash@codecov-commenter@DenizAltunkapan

[8]ページ先頭

©2009-2025 Movatter.jp