Cipher is your all-in-one toolkit for classic cryptography. Built with a Next.js frontend and a FastAPI backend, it lets you Encrypt, Decrypt, run Frequency Analysis Attacks, and generate detailed Reports - all from a clean & modern interface.
| CIPHER | KEY TYPE | ENCRYPTION / DECRYPTION | FREQUENCY ANALYSIS ATTACK |
|---|---|---|---|
| Caesar Cipher | Integer Shift | ✅ Supported | ✅ Supported |
| Permutation Cipher | Permutation Alphabetic | ✅ Supported | ✅ Supported |
| Vigenère Cipher | Polyalphabetic | ✅ Supported | ✅ Supported |
| Playfair Cipher (8x8) | Alphanumeric | ✅ Supported | ❌ Unsupported |
| Hill Cipher (2x2) | Numeric Matrix | ✅ Supported | ✅ Supported |
| DES | 64 bit Hex | ✅ Supported | ❌ Unsupported |
| AES | 128/192/256 bit Hex | ✅ Supported | |
| RC5 | 16/32/64 bit Hex | ✅ Supported |
Cipher uses a decoupled architecture with a Next.js frontend and a FastAPI backend, connected over REST with real-time SSE streaming for frequency analysis attacks. All 8 cipher implementations live in modular Python routers, each handling encrypt, decrypt, key generation, and (where applicable) attack logic independently.
| # | COMPONENT | DESCRIPTION | STACK |
|---|---|---|---|
| 1️⃣ | Frontend | Pages for encrypt, decrypt, attack & report | TypeScript, Next.js, Tailwind CSS, shadcn/ui |
| 2️⃣ | Backend | REST API handling all cipher operations | Python, FastAPI, Uvicorn |
| 3️⃣ | Cipher Core | Implementations of all 8 supported ciphers | Python |
| 4️⃣ | Attack Engine | Frequency analysis with real-time SSE streaming | FastAPI SSE, Python |
| 5️⃣ | Report | Generates downloadable comparison reports | FastAPI, Next.js |
Cipher/
├── frontend/ # Next.js frontend
│ ├── app/ # Pages
│ │ ├── page.tsx # Home
│ │ ├── encrypt/ # Encryption page
│ │ ├── decrypt/ # Decryption page
│ │ ├── attack/ # Frequency analysis attack page
│ │ ├── report/ # Report generation page
│ │ └── layout.tsx # Root layout
│ ├── components/ # UI components (shadcn) + custom components
│ ├── lib/ # Utilities (cn.ts)
│ ├── hooks/ # Custom React hooks
│ └── public/ # Static assets
├── backend/ # FastAPI backend
│ └── app/
│ ├── main.py # FastAPI app entry point
│ ├── config.py # App configuration
│ ├── routes.py # API route definitions
│ ├── routers/ # Cipher implementations
│ │ ├── caesar/ # Caesar cipher (encrypt, decrypt, attack)
│ │ ├── permute/ # Permutation cipher
│ │ ├── vigenere/ # Vigenère cipher
│ │ ├── playfair/ # Playfair cipher (8x8)
│ │ ├── hill/ # Hill cipher (2x2)
│ │ ├── des/ # DES
│ │ ├── aes/ # AES
│ │ ├── rc5/ # RC5
│ │ └── report.py # Report generation
│ └── static/ # Static files
├── README.md
└── .gitignore
For detailed setup and usage instructions, refer to the respective README files:
- 🖥️
Backend Instructions- Setting up & running the FastAPI backend - 🌐
Frontend Instructions- Setting up & running the Next.js frontend
Made with 🔑 by Saptarshi Roy & Krishnendu Das

