ElGamal Encryption

ElGamal Encryption

Given a cyclic group G\mathbb{G} of order qq and its generator gg, the encryption and decryption process for a message MM is defined as follows.

ElGamal Encryption Process

ElGamal.Setup()(x,y)\mathsf{ElGamal.Setup}() \rightarrow (x, y):

  • Select a secret key xx randomly from the range 1x<q11 \leq x < q-1.

  • Compute the public key yy as follows:

y=gxy = g^x

ElGamal.Encrypt(M,y)(c1,c2)\mathsf{ElGamal.Encrypt}(M, y) \rightarrow (c_1, c_2):

  • Map the message MM to an element mGm \in \mathbb{G}.

  • Select a random value kk from the range 1k<q11 \leq k < q-1.

  • Compute the shared secret ss:

s=yks = y^k
  • Generate the ciphertext (c1,c2)(c_1, c_2) as follows:

c1=gk,c2=msc_1 = g^k, \quad c_2 = m \cdot s

ElGamal.Decrypt(c1,c2,x)M\mathsf{ElGamal.Decrypt}(c_1, c_2, x) \rightarrow M:

  • Recover the shared secret ss (This can only be done by the owner of xx):

s=c1x=(gk)x=(gx)k=yks = c_1^x = (g^k)^x = (g^x)^k = y^k
  • Retrieve the original message mm:

m=c2s1=(ms)s1m = c_2 \cdot s^{-1} = (m \cdot s) \cdot s^{-1}
  • Convert mm back to the message MM.

References

Written by ryan Kim from A41

Last updated