4.2 ElGamal
The ElGamal Cryptosystem is based on the Discrete Logarithm problem.
that means the difficulty of computing a if β =
αa(mod p) is known, where p is
prime.
In the presented form only numbers can be encrypted; texts must
previously be coded suitable.
The ElGamal Cryptosystem consists of three steps
- Gernerating the key:
- Choose a large prime Primzahl p (see
2.3.2), such that
(p - 1) / 2 is prime, too* (see
2.3.1).
N is the number of bits of p.
- Choose the base α < p.
- Choose the private key a < p.
- Compute β = αa(mod p)
- Publish p, α and β as public key.
- Encryption of a message:
- Split the plaintext into blocks of N - 1 bits
(fill them up if necessary).
- Choose a secret random number k with gcd(k,
p - 1) = 1 (see 2.1)
- Compute for every block x the ciphertext
e (x, k) = (y1,
y2), where
y1 = αk(mod p)
and
y2 = βkx (mod
p).
y1 and y2 are blocks of the
length N of ciphertext.
- Decryption:
- Split the ciphertext in blocks of N bits
- For two successive blocks
y1 and y2 solve
y1a x =
y2 (mod p)
for x.
Thus
d (y1, y2) = x =
y2
(y1a )-1 (mod p)
is the wanted block of plaintext.
* For the special case, that (p - 1) / 2 is also a
prime, there is a known algorithm to compute the Discrete Logarithm
problem.
4.2 ElGamal: Sample applet for small numbers
source