A command-line encryption tool built in C++ that implements the classic Caesar Cipher — engineered with clean Object-Oriented design, robust file handling, and a polished menu-driven interface.
Caesar Cipher CLI is a lightweight, dependency-free C++ application for encrypting and decrypting text using the Caesar Cipher algorithm — one of the oldest and most well-known encryption techniques in cryptographic history.
The project is designed with production-style code organization in mind: separated headers and source files, dedicated classes for encryption and decryption logic, isolated I/O handling, and strict input validation — making it an excellent reference for anyone learning C++ project architecture.
|
|
|
| Technology | Purpose |
|---|---|
| Core application logic | |
| Encryption/decryption modeled as classes | |
| Reading and writing cipher data | |
| Version control | |
| Hosting and collaboration |
CaesarCipherCLI/
│
├── include/
│ ├── encryption.h # Encryption class declaration
│ ├── decryption.h # Decryption class declaration
│ └── menu.h # Menu / CLI interface declaration
│
├── src/
│ ├── encryption.cpp # Encryption logic implementation
│ ├── decryption.cpp # Decryption logic implementation
│ ├── menu.cpp # Menu-driven interface implementation
│ └── main.cpp # Application entry point
│
├── data/
│ ├── input.txt # Source plaintext
│ ├── encrypted.txt # Generated ciphertext
│ └── decrypted.txt # Recovered plaintext
│
├── .gitignore
├── LICENSE
└── README.md
classDiagram
class Menu {
+displayMenu()
+getUserChoice() int
+run()
}
class Encryption {
-int shiftKey
+Encryption(shift int)
+encryptText(text string) string
+readInput(path string) string
+writeOutput(path string, data string)
}
class Decryption {
-int shiftKey
+Decryption(shift int)
+decryptText(text string) string
+readInput(path string) string
+writeOutput(path string, data string)
}
Menu --> Encryption : invokes
Menu --> Decryption : invokes
g++ src/main.cpp src/menu.cpp src/encryption.cpp src/decryption.cpp -Iinclude -o CaesarCipher.exe| Linux / macOS |
./CaesarCipher.exe |
| Windows |
CaesarCipher.exe |
flowchart LR
A[Start] --> B{Select Mode}
B -->|Encrypt| C[Read data/input.txt]
B -->|Decrypt| D[Read data/encrypted.txt]
C --> E[Enter Shift Value]
D --> E
E --> F[Apply Caesar Cipher]
F --> G[Write Output File]
G --> H[Exit or Repeat]
- Launch the application and choose an option from the menu — Encrypt, Decrypt, or Exit.
- Enter a numeric shift value to define the cipher key.
- The program reads source text from
data/input.txt. - Encrypted output is written to
data/encrypted.txt. - Decrypted output is written to
data/decrypted.txt.
| Stage | Value |
|---|---|
| Input | Hello World |
| Shift Key | 3 |
| Encrypted Output | Khoor Zruog |
| Decrypted Output | Hello World |
Click to expand planned improvements
- Encrypt custom user input directly from the terminal
- Generate random shift keys automatically
- Support additional cipher algorithms (Vigenère, ROT13, etc.)
- Maintain a persistent encryption/decryption history log
- Enhance the console UI with color output and formatting
Pull requests are welcome. For major changes, please open an issue first to discuss what you'd like to change.
|
1. Fork |
2. Branch |
3. Commit |
4. Pull Request |