El Gamal Encryption
Here, we summarize the El Gamal cryptosystem.
Consult
wikipedia
for more detail.
- KeyGen:
- Choose a random prime p.
- Choose a random generator g modulo p.
- Choose the decryption exponent x randomly from {1, ... , p-1}.
- Let y be gx mod p.
- Return the public key pk = (y, g, p) and the secret key sk = x.
- Enc(pk = (y, g, p), m), where m is a message to be encrypted:
- Choose r randomly from {1, ..., p-1}.
- Let s = yr.
- Let c1 = gr mod p.
- Let c2 = sm mod p.
- Return the ciphertext c = (c1, c2).
- Dec(sk = x, c), where c is a ciphertext to be decrypted:
- Let s = c1x mod p.
- Return the recovered message m = (c2 / s) mod p.