LogoLogo
LogoLogo
  • Introduction
    • About Us
    • Notations & Definitions
      • MPC
      • ZK
    • Contribute to this Site!
  • Primitives
    • Multiplication
      • Karatsuba Multiplication
      • Toom-Cook Multiplication
    • NAF (Non-adjacent form)
    • Chinese Remainder Theorem (CRT)
    • Euclidean Algorithm
      • Extended Euclidean Algorithm
      • Binary Euclidean Algorithm
      • Extended Binary Euclidean Algorithm
    • Coding Theory
      • Linear Code
    • Number Theoretic Transform
    • Abstract Algebra
      • Group
        • -Morphisms
        • Batch Inverse
      • Elliptic Curve
        • Weierstrass Curve
          • Coordinate Forms
          • Fast Elliptic Curve Arithmetic and Improved WEIL Pairing Evaluation
        • Edwards Curve
          • Coordinate Forms
          • Twisted Edwards ↔ Short Weierstrass Transformation
        • Batch Inverse for Batch Point Additions
        • Scalar Multiplication
          • Double-and-add
          • GLV Decomposition
        • MSM
          • Pippenger's Algorithm
          • Signed Bucket Index
          • CycloneMSM
          • EdMSM
          • cuZK
        • 2-Chain and 2-Cycle of Elliptic Curves
    • Encryption Scheme
      • ElGamal Encryption
    • Modular Arithmetic
      • Modular Reduction
        • Barrett Reduction
        • Montgomery Reduction
      • Modular Inverse
        • Bernstein-Yang's Inverse
    • Multiset Check
    • Sumcheck
    • Commitment Scheme
      • Fflonk
      • SHPlonk
      • Zeromorph
  • MPC
    • Yao's Garbled Circuits
    • GMW
    • BMR
  • ZK
    • Arithmetization
      • R1CS
      • PLONK
      • AIR
    • Folding
      • LatticeFold
      • Nova
        • Nova over Cycles of Curves
    • Lookup
      • Lasso
      • LogUp-GKR
    • SNARK
      • Groth16
      • HyperPlonk
      • Spartan
        • SPARK
    • STARK
      • Additive NTT
      • Basefold
      • Binius
      • Brakedown
      • CircleSTARK
      • FRI
        • FRI Security Features and Optimizations
      • DEEP FRI
      • STIR
      • WHIR
    • Distributed ZK
      • Ryan's Trick for Distributed Groth16
  • Application
    • zkLogin
    • zkHoldem
    • zkTLS
      • DECO
      • Proxying is enough
  • zkVM
Powered by GitBook
On this page
  • ElGamal Encryption
  • ElGamal Encryption Process
  • References
Export as PDF
  1. Primitives
  2. Encryption Scheme

ElGamal Encryption

ElGamal Encryption

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

ElGamal Encryption Process

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

  • Select a secret key xxx randomly from the range 1≤x<q−11 \leq x < q-11≤x<q−1.

  • Compute the public key yyy as follows:

y=gxy = g^xy=gx

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

  • Map the message MMM to an element m∈Gm \in \mathbb{G}m∈G.

  • Select a random value kkk from the range 1≤k<q−11 \leq k < q-11≤k<q−1.

  • Compute the shared secret sss:

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

c1=gk,c2=m⋅sc_1 = g^k, \quad c_2 = m \cdot sc1​=gk,c2​=m⋅s

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

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

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

m=c2⋅s−1=(m⋅s)⋅s−1m = c_2 \cdot s^{-1} = (m \cdot s) \cdot s^{-1}m=c2​⋅s−1=(m⋅s)⋅s−1
  • Convert mmm back to the message MMM.

References

PreviousEncryption SchemeNextModular Arithmetic

Last updated 1 month ago

Written by from

https://en.wikipedia.org/wiki/ElGamal_encryption
A41
ryan Kim