ElGamal public-key encryption

The ElGamal public-key encryption scheme can be viewed as Diffie-Hellman key agreement in key transfer mode. Its security is based on the intractability of the discrete logarithm problem and the Diffie-Hellman problem. The basic ElGamal and generalized ElGamal encryption schemes are described in this section.

Proof that decryption works. The decryption of Algorithm allows recovery of original plaintext because