In cryptography, the ElGamal encryption system is an asymmetric key encryption algorithm for publickey cryptography which is based on the Diffie–Hellman key exchange. It was described by Taher Elgamal in 1984.^{[1]} ElGamal encryption is used in the free GNU Privacy Guard software, recent versions of PGP, and other cryptosystems. The Digital Signature Algorithm is a variant of the ElGamal signature scheme, which should not be confused with ElGamal encryption.
ElGamal encryption can be defined over any cyclic group . Its security depends upon the difficulty of a certain problem in related to computing discrete logarithms (see below).
The algorithm[]
ElGamal encryption consists of three components: the key generator, the encryption algorithm, and the decryption algorithm.
Key generation[]
The key generator works as follows:
 Alice generates an efficient description of a multiplicative cyclic group of order with generator . See below for a discussion on the required properties of this group.
 Alice chooses a random from .
 Alice computes .
 Alice publishes , along with the description of , as her public key. Alice retains as her private key which must be kept secret.
Encryption[]
The encryption algorithm works as follows: to encrypt a message to Alice under her public key ,
 Bob chooses a random from , then calculates .
 Bob calculates the shared secret . Since a new is computed for every message is also called an ephemeral key.
The steps above can be computed ahead of time.
 Bob converts his secret message into an element of .
 Bob calculates .
 Bob sends the ciphertext to Alice.
Decryption[]
The decryption algorithm works as follows: to decrypt a ciphertext with her private key ,
 Alice calculates the shared secret
 and then computes which she then converts back into the plaintext message .
The decryption algorithm produces the intended message, since
The ElGamal cryptosystem is usually used in a hybrid cryptosystem. I.e., the message itself is encrypted using a symmetric cryptosystem and ElGamal is then used to encrypt the key used for the symmetric cryptosystem. This allows encryption of messages that are longer than the size of the group .
Security[]
The security of the ElGamal scheme depends on the properties of the underlying group as well as any padding scheme used on the messages.
If the computational Diffie–Hellman assumption holds in the underlying cyclic group , then the encryption function is oneway^{[2]}.
If the decisional Diffie–Hellman assumption (DDH) holds in , then ElGamal achieves semantic security.^{[2]} Semantic security is not implied by the computational Diffie–Hellman assumption alone^{[3]}. See decisional Diffie–Hellman assumption for a discussion of groups where the assumption is believed to hold.
ElGamal encryption is unconditionally malleable, and therefore is not secure under chosen ciphertext attack. For example, given an encryption of some (possibly unknown) message , one can easily construct a valid encryption of the message .
To achieve chosenciphertext security, the scheme must be further modified, or an appropriate padding scheme must be used. Depending on the modification, the DDH assumption may or may not be necessary.
Other schemes related to ElGamal which achieve security against chosen ciphertext attacks have also been proposed. The Cramer–Shoup cryptosystem is secure under chosen ciphertext attack assuming DDH holds for . Its proof does not use the random oracle model. Another proposed scheme is DHAES^{[3]}, whose proof requires an assumption that is weaker than the DDH assumption.
Efficiency[]
ElGamal encryption is probabilistic, meaning that a single plaintext can be encrypted to many possible ciphertexts, with the consequence that a general ElGamal encryption produces a 2:1 expansion in size from plaintext to ciphertext.
Encryption under ElGamal requires two exponentiations; however, these exponentiations are independent of the message and can be computed ahead of time if need be. Decryption only requires one exponentiation:
Decryption[]
The division by can be avoided by using an alternative method for decryption. To decrypt a ciphertext with Alice's private key ,
 Alice calculates .
is the inverse of . This is a consequence of Lagrange's theorem, because
 .
 Alice then computes , which she then converts back into the plaintext message .
The decryption algorithm produces the intended message, since
 .
See also[]
References[]
 ↑ Template:Cite journal (conference version appeared in CRYPTO'84, pp. 10–18)
 ↑ ^{2.0} ^{2.1} CRYPTUTOR, "Elgamal encryption scheme"
 ↑ ^{3.0} ^{3.1} M. Abdalla, M. Bellare, P. Rogaway, "DHAES, An encryption scheme based on the Diffie–Hellman Problem" (Appendix A)
 Template:Cite conference
 Template:Cite book
 Template:Cite journal

bg:Elgamal cs:ElGamal de:ElgamalKryptosystem es:Cifrado ElGamal fr:Cryptosystème de ElGamal it:ElGamal he:צופן אלגמאל lt:ElGamal kriptosistema nl:Elgamalencryptiesysteem ja:ElGamal暗号 pl:ElGamal pt:El Gamal ru:Схема ЭльГамаля fi:ElGamal sv:ElGamalkryptering tr:ElGamal