ECC vs ElGamal — Live Performance and Security Benchmarking in Data Transmission
Generate keys. Encrypt messages. Simulate secure data transmission. Benchmark both algorithms live — no installation required.
** Live App:** https://ecc-elgamal.vercel.app
** API:** https://ecc-elgamal.onrender.com/docs
CipherDuel is an open-source cryptographic benchmarking tool that compares two asymmetric encryption algorithms — Elliptic Curve Cryptography (ECC) and the ElGamal cryptosystem — in the context of secure data transmission.
It answers a practical question: which algorithm should you use when encrypting data in transit?
You can:
- Generate ECC or ElGamal key pairs in your browser
- Encrypt any message using either algorithm
- Decrypt ciphertext and recover the original message
- Simulate encrypted data transmission between two ports (port 5000 → port 5001) with integrity verification
- Run live benchmarks measuring key generation speed, encryption speed, decryption speed, and memory consumption — with real-time charts
This project is the implementation artefact for a final year B.Sc. Computer Science project at Federal University Lokoja, Nigeria.
📸 Screenshot 1 — Home page
(Full browser view of the landing page showing the CipherDuel title, algorithm comparison cards, and tab navigation)
📸 Screenshot 2 — ECC Key Generation
(The Key Generation panel after clicking "Generate Key Pair" with ECC selected, showing the PEM-encoded public and private keys)
📸 Screenshot 3 — ElGamal Key Generation
(The same panel with ElGamal selected, showing hex-encoded keys and group parameters)
📸 Screenshot 4 — Encryption Panel
(A message typed in the input, ECC selected, with the resulting JSON ciphertext displayed below)
📸 Screenshot 5 — Decryption Panel
(Ciphertext pasted into the input, private key entered, showing the recovered plaintext in the green result box)
📸 Screenshot 6 — Transmission Simulation
(The transmission panel showing port 5000 → port 5001 arrow, a completed transmission with the green "Integrity Verified" badge and SHA-256 hash comparison)
📸 Screenshot 7 — Benchmark Dashboard
(All four benchmark charts visible: key generation, encryption, decryption, and memory consumption bar charts with ECC in indigo and ElGamal in grey)
📸 Screenshot 8 — Memory Consumption Chart
(Close-up of the peak memory consumption chart showing the difference between ECC and ElGamal)
| Layer | Technology |
|---|---|
| Frontend | Next.js 14 (App Router), TypeScript, Tailwind CSS |
| Animations | Framer Motion |
| Charts | Chart.js + react-chartjs-2 |
| Icons | Lucide React |
| Backend | FastAPI (Python 3.11) |
| ECC | cryptography library (OpenSSL backend) — NIST P-256 |
| ElGamal | pycryptodome — RFC 3526 MODP Group 14 (3072-bit) |
| Timing | time.perf_counter() (nanosecond resolution) |
| Memory | tracemalloc (peak heap profiling) |
| Frontend Hosting | Vercel |
| Backend Hosting | Render |
git clone https://github.com/vehutech/ecc-elgamal.git
cd ecc-elgamalcd backend
# Create and activate virtual environment
python -m venv venv
source venv/bin/activate # macOS / Linux
# venv\Scripts\activate # Windows
# Install dependencies
pip install -r requirements.txt
# Start the development server
uvicorn main:app --reload --port 8000The API will be running at http://localhost:8000.
Visit http://localhost:8000/docs for the interactive Swagger UI.
cd frontend
# Copy environment variables
cp .env.local.example .env.local
# .env.local already points to http://localhost:8000 — no changes needed for local dev
# Install dependencies
npm install
# Start the development server
npm run devThe app will be running at http://localhost:3000.
Go to http://localhost:3000.
Both backend and frontend must be running simultaneously.
| Variable | Description | Default |
|---|---|---|
NEXT_PUBLIC_API_URL |
URL of the FastAPI backend | http://localhost:8000 |
For production (Vercel), set NEXT_PUBLIC_API_URL to your Render backend URL:
https://ecc-elgamal-api.onrender.com
See DEVELOPMENT.md for the complete step-by-step guide from local development to production deployment on Render and Vercel.
Quick summary:
- Push code to GitHub (
vehutech/ecc-elgamal) - Connect Render to the
backend/folder → auto-deploys on push - Connect Vercel to the
frontend/folder → auto-deploys on push - Set
NEXT_PUBLIC_API_URLin Vercel environment variables
| Method | Endpoint | Description |
|---|---|---|
GET |
/ |
Service info |
GET |
/health |
Health check |
POST |
/ecc/keygen |
Generate ECC key pair |
POST |
/ecc/encrypt |
Encrypt with ECC (ECIES) |
POST |
/ecc/decrypt |
Decrypt ECC ciphertext |
POST |
/elgamal/keygen |
Generate ElGamal key pair |
POST |
/elgamal/encrypt |
Encrypt with ElGamal |
POST |
/elgamal/decrypt |
Decrypt ElGamal ciphertext |
POST |
/transmit |
Simulate encrypted port-to-port transmission |
POST |
/benchmark |
Full comparison benchmark (both algorithms) |
POST |
/benchmark/ecc |
ECC-only benchmark |
POST |
/benchmark/elgamal |
ElGamal-only benchmark |
Full interactive docs: https://ecc-elgamal.onrender.com/docs
ecc-elgamal/
│
├── backend/
│ ├── ecc_module.py # ECC key gen, ECIES encrypt/decrypt
│ ├── elgamal_module.py # ElGamal key gen, encrypt/decrypt
│ ├── benchmark_module.py # Timing + memory profiling
│ ├── transmission_module.py # Port-to-port transmission simulation
│ ├── main.py # FastAPI app and routes
│ ├── requirements.txt
│ ├── Procfile # Render start command
│ └──
│
├── frontend/
│ ├── src/
│ │ ├── app/
│ │ │ ├── layout.tsx # Root layout (fonts, theme)
│ │ │ ├── page.tsx # Main page (hero + tabs)
│ │ │ └── globals.css # CSS variables + base styles
│ │ ├── components/
│ │ │ ├── layout/ # Navbar, Footer
│ │ │ ├── panels/ # KeyGenPanel, EncryptDecryptPanel, etc.
│ │ │ └── ui/ # Skeleton, StatCard
│ │ └── lib/
│ │ ├── api.ts # Typed API client
│ │ ├── utils.ts # Formatting helpers
│ │ └── theme.tsx # Dark/light mode context
│ ├── tailwind.config.js
│ ├── next.config.js
│ └── package.json
│
├── README.md
├── DEVELOPMENT.md
├── LICENSE
└── .gitignore
Contributions are welcome. Please open an issue before submitting a pull request so we can discuss the change.
- Fork the repository
- Create a feature branch:
git checkout -b feature/your-feature - Commit your changes:
git commit -m 'feat: add your feature' - Push to the branch:
git push origin feature/your-feature - Open a pull request
MIT License — see LICENSE for details.
Daniel Vehu Alonge — SCI21CSC229
B.Sc. Computer Science, Federal University Lokoja
Supervisor: Dr. Malik Adeiza Rufai
Built by D. Vehu Alonge
GitHub: @vehutech