ElGamal Cryptography
Introduction
•The ElGamal cryptosystem was proposed by Taher ElGamal in 1985.
•It is an asymmetric key cryptosystem used for encryption and digital
signatures.
•Its security is based on the Discrete Logarithm Problem (DLP), which is
computationally hard to solve.
•Widely used in secure communication systems such as PGP, GPG,
SSL/TLS, and also forms the basis of DSA (Digital Signature Algorithm).
Features
•Asymmetric Cryptography: Uses a public key for encryption
and a private key for decryption.
•Probabilistic Encryption: Same plaintext generates different
ciphertexts each time (due to randomization).
•Security Based on DLP: Breaking ElGamal requires solving
discrete logarithms, which is infeasible for large numbers.
•Versatility: Supports both encryption and digital signatures.
•Scalability: Works with large prime numbers to provide higher
levels of security.
Key Generation
1. Choose a large prime number p
2. Select primitive root g
3. Choose private key x, 1 < x < p-1
4. Compute public key: y = g^x mod p
Public key = (p, g, y)
Private key = x
Encryption Process
To encrypt message M:
1. Choose random integer k
2. Compute:
C1 = g^k mod p
C2 = (M · y^k) mod p
3. Ciphertext = (C1, C2)
Decryption Process
To decrypt (C1, C2):
1. Compute s = C1^x mod p
2. Compute s^-1 (modular inverse of s)
3. Recover plaintext:
M = (C2 · s^-1) mod p
Example
Prime p = 17
Primitive root g = 3
Private key x = 15
Public key: y = g^x mod p = 3^15 mod 17 = 6
Public key = (17, 3, 6)
Private key = 15
Example
ENCRYPTION DECRYPTION
Message M = 13 Ciphertext = (8, 8)
Choose random k = 10 Compute s = C1^x mod p = 8^15
mod 17 = 15
C1 = g^k mod p = 3^10 mod 17 =
8 Find s^-1 mod 17 = 8
C2 = (M · y^k) mod p = (13 · Recover message:
6^10) mod 17
M = (C2 · s^-1) mod 17 = (8 · 8)
6^10 mod 17 = 15 mod 17 = 13
C2 = (13 · 15) mod 17 = 8 Decrypted message = 13
Ciphertext = (8, 8)
Advantages &
Disadvantages
•Advantages
• Strong security (based on Discrete Logarithm Problem)
• Randomized encryption → same message gives different ciphertext
• Supports both encryption and digital signatures
• Provides confidentiality & authenticity
•Disadvantages
• Ciphertext size is 2× plaintext size
• Slower than symmetric algorithms (AES, DES)
• Needs very large primes for strong security
• Inefficient for encrypting large amounts of data
Applications & Conclusion
•Used in PGP/GPG for secure emails and file encryption.
•Basis of the Digital Signature Algorithm (DSA).
•Secures internet communication through SSL/TLS protocols.
•Common in hybrid cryptosystems to protect session keys.
•Conclusion: ElGamal is a secure but slower asymmetric cryptosystem, best
suited for authentication and key exchange in modern security systems.