Java
Java copied to clipboard
Add ElGamalCipher implementing ElGamal encryption and decryption
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
- [x] Code compiles successfully
- [x] Tests passed locally (BUILD SUCCESS)
- [x] Follows project style and structure
- [x] Added clear example output
- [x] Confirmed correct encryption and decryption results