ElGamal Encryption
Last updated
Given a cyclic group G of order q and its generator g, the encryption and decryption process for a message M is defined as follows.
Select a secret key x randomly from the range 1≤x<q−1.
Compute the public key y as follows:
Map the message M to an element m∈G.
Select a random value k from the range 1≤k<q−1.
Compute the shared secret s:
Generate the ciphertext (c1,c2) as follows:
Recover the shared secret s (This can only be done by the owner of x):
Retrieve the original message m:
Convert m back to the message M.
Written by Ryan Kim of Fractalyze
Last updated