ElGamal Encryption Calculator

Enter a prime p, generator g, private key x, ephemeral key k, and message m.

How to use

  1. Enter your values in the fields above.
  2. Press Calculate to see your result instantly.
  3. Use the Share button to copy a link to your result.

About this calculator

The ElGamal cryptosystem, published by Taher Elgamal in 1985, is a public-key encryption scheme whose security rests on the discrete logarithm problem in a finite cyclic group — given a prime p and generator g, it's computationally hard to recover x from y = g^x mod p. Key generation picks a private key x and publishes y = g^x mod p as the public key; encryption then draws a fresh random ephemeral key k for every message and produces a ciphertext pair (c₁, c₂) = (g^k mod p, m·y^k mod p), so the same plaintext never encrypts to the same ciphertext twice.

This calculator walks through that math step by step: enter a small prime p, generator g, private key x, ephemeral key k, and an integer message m, and it derives the public key and the resulting ciphertext pair exactly as the algorithm would. Cryptography students, computer science instructors, and security engineers use toy examples like this to build intuition for asymmetric encryption and for the discrete-log basis that also underlies Diffie-Hellman key exchange and the DSA signature scheme — real deployments use primes hundreds of digits long, far beyond hand or calculator arithmetic.

Was this helpful?

Comments (0)

  • Be the first to comment.

Popular calculators

All Calculators