<s>
In	O
cryptography	O
,	O
the	O
ElGamal	B-Algorithm
encryption	I-Algorithm
system	O
is	O
an	O
asymmetric	B-Application
key	I-Application
encryption	I-Application
algorithm	I-Application
for	O
public-key	B-Application
cryptography	I-Application
which	O
is	O
based	O
on	O
the	O
Diffie	B-Protocol
–	I-Protocol
Hellman	I-Protocol
key	I-Protocol
exchange	I-Protocol
.	O
</s>
<s>
It	O
was	O
described	O
by	O
Taher	O
Elgamal	B-Algorithm
in	O
1985	O
.	O
</s>
<s>
ElGamal	B-Algorithm
encryption	I-Algorithm
is	O
used	O
in	O
the	O
free	O
GNU	B-Application
Privacy	I-Application
Guard	I-Application
software	O
,	O
recent	O
versions	O
of	O
PGP	B-Application
,	O
and	O
other	O
cryptosystems	B-General_Concept
.	O
</s>
<s>
The	O
Digital	O
Signature	O
Algorithm	O
(	O
DSA	O
)	O
is	O
a	O
variant	O
of	O
the	O
ElGamal	B-Algorithm
signature	I-Algorithm
scheme	I-Algorithm
,	O
which	O
should	O
not	O
be	O
confused	O
with	O
ElGamal	B-Algorithm
encryption	I-Algorithm
.	O
</s>
<s>
ElGamal	B-Algorithm
encryption	I-Algorithm
can	O
be	O
defined	O
over	O
any	O
cyclic	O
group	O
,	O
like	O
multiplicative	O
group	O
of	O
integers	O
modulo	O
n	O
.	O
Its	O
security	O
depends	O
upon	O
the	O
difficulty	O
of	O
a	O
certain	O
problem	O
in	O
related	O
to	O
computing	O
discrete	O
logarithms	O
.	O
</s>
<s>
ElGamal	B-Algorithm
encryption	I-Algorithm
consists	O
of	O
three	O
components	O
:	O
the	O
key	O
generator	O
,	O
the	O
encryption	O
algorithm	O
,	O
and	O
the	O
decryption	O
algorithm	O
.	O
</s>
<s>
The	O
first	O
party	O
,	O
Alice	O
,	O
generates	O
a	O
key	B-Application
pair	I-Application
as	O
follows	O
:	O
</s>
<s>
The	O
public	B-Application
key	I-Application
consists	O
of	O
the	O
values	O
.	O
</s>
<s>
Alice	O
publishes	O
this	O
public	B-Application
key	I-Application
and	O
retains	O
as	O
her	O
private	B-Application
key	I-Application
,	O
which	O
must	O
be	O
kept	O
secret	O
.	O
</s>
<s>
A	O
second	O
party	O
,	O
Bob	O
,	O
encrypts	O
a	O
message	O
to	O
Alice	O
under	O
her	O
public	B-Application
key	I-Application
as	O
follows	O
:	O
</s>
<s>
For	O
this	O
reason	O
,	O
is	O
also	O
called	O
an	O
ephemeral	B-General_Concept
key	I-General_Concept
.	O
</s>
<s>
Alice	O
decrypts	O
a	O
ciphertext	O
with	O
her	O
private	B-Application
key	I-Application
as	O
follows	O
:	O
</s>
<s>
Like	O
most	O
public	B-Application
key	I-Application
systems	O
,	O
the	O
ElGamal	B-Algorithm
cryptosystem	I-Algorithm
is	O
usually	O
used	O
as	O
part	O
of	O
a	O
hybrid	O
cryptosystem	B-General_Concept
,	O
where	O
the	O
message	O
itself	O
is	O
encrypted	O
using	O
a	O
symmetric	O
cryptosystem	B-General_Concept
,	O
and	O
ElGamal	B-Algorithm
is	O
then	O
used	O
to	O
encrypt	O
only	O
the	O
symmetric	O
key	O
.	O
</s>
<s>
This	O
is	O
because	O
asymmetric	B-Application
cryptosystems	I-Application
like	O
ElGamal	B-Algorithm
are	O
usually	O
slower	O
than	O
symmetric	O
ones	O
for	O
the	O
same	O
level	O
of	O
security	O
,	O
so	O
it	O
is	O
faster	O
to	O
encrypt	O
the	O
message	O
,	O
which	O
can	O
be	O
arbitrarily	O
large	O
,	O
with	O
a	O
symmetric	O
cipher	O
,	O
and	O
then	O
use	O
ElGamal	B-Algorithm
only	O
to	O
encrypt	O
the	O
symmetric	O
key	O
,	O
which	O
usually	O
is	O
quite	O
small	O
compared	O
to	O
the	O
size	O
of	O
the	O
message	O
.	O
</s>
<s>
The	O
security	O
of	O
the	O
ElGamal	B-Algorithm
scheme	O
depends	O
on	O
the	O
properties	O
of	O
the	O
underlying	O
group	O
as	O
well	O
as	O
any	O
padding	O
scheme	O
used	O
on	O
the	O
messages	O
.	O
</s>
<s>
If	O
the	O
computational	O
Diffie	B-Protocol
–	I-Protocol
Hellman	I-Protocol
assumption	O
(	O
CDH	O
)	O
holds	O
in	O
the	O
underlying	O
cyclic	O
group	O
,	O
then	O
the	O
encryption	O
function	O
is	O
one-way	O
.	O
</s>
<s>
ElGamal	B-Algorithm
achieves	O
semantic	O
security	O
.	O
</s>
<s>
Semantic	O
security	O
is	O
not	O
implied	O
by	O
the	O
computational	O
Diffie	B-Protocol
–	I-Protocol
Hellman	I-Protocol
assumption	O
alone	O
.	O
</s>
<s>
See	O
Decisional	O
Diffie	B-Protocol
–	I-Protocol
Hellman	I-Protocol
assumption	O
for	O
a	O
discussion	O
of	O
groups	O
where	O
the	O
assumption	O
is	O
believed	O
to	O
hold	O
.	O
</s>
<s>
ElGamal	B-Algorithm
encryption	I-Algorithm
is	O
unconditionally	O
malleable	O
,	O
and	O
therefore	O
is	O
not	O
secure	O
under	O
chosen	O
ciphertext	O
attack	O
.	O
</s>
<s>
Other	O
schemes	O
related	O
to	O
ElGamal	B-Algorithm
which	O
achieve	O
security	O
against	O
chosen	O
ciphertext	O
attacks	O
have	O
also	O
been	O
proposed	O
.	O
</s>
<s>
The	O
Cramer	B-Algorithm
–	I-Algorithm
Shoup	I-Algorithm
cryptosystem	I-Algorithm
is	O
secure	O
under	O
chosen	O
ciphertext	O
attack	O
assuming	O
DDH	O
holds	O
for	O
.	O
</s>
<s>
Its	O
proof	O
does	O
not	O
use	O
the	O
random	B-Application
oracle	I-Application
model	I-Application
.	O
</s>
<s>
Another	O
proposed	O
scheme	O
is	O
DHIES	B-Protocol
,	O
whose	O
proof	O
requires	O
an	O
assumption	O
that	O
is	O
stronger	O
than	O
the	O
DDH	O
assumption	O
.	O
</s>
<s>
ElGamal	B-Algorithm
encryption	I-Algorithm
is	O
probabilistic	O
,	O
meaning	O
that	O
a	O
single	O
plaintext	O
can	O
be	O
encrypted	O
to	O
many	O
possible	O
ciphertexts	O
,	O
with	O
the	O
consequence	O
that	O
a	O
general	O
ElGamal	B-Algorithm
encryption	I-Algorithm
produces	O
a	O
1:2	O
expansion	O
in	O
size	O
from	O
plaintext	O
to	O
ciphertext	O
.	O
</s>
<s>
Encryption	O
under	O
ElGamal	B-Algorithm
requires	O
two	O
exponentiations	O
;	O
however	O
,	O
these	O
exponentiations	O
are	O
independent	O
of	O
the	O
message	O
and	O
can	O
be	O
computed	O
ahead	O
of	O
time	O
if	O
needed	O
.	O
</s>
