Skip to content

Latest commit

 

History

9 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation



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.

Table of Contents

Overview

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.


Features

Core Cryptography

  • Caesar Cipher encryption engine
  • Symmetric decryption using the same shift key
  • Full alphabet wrap-around handling

File Handling

  • Reads plaintext from data/input.txt
  • Writes ciphertext to data/encrypted.txt
  • Writes decrypted output to data/decrypted.txt

User Experience

  • Clean, menu-driven CLI interface
  • Input validation on menu choices and shift keys
  • Modular, multi-file project layout

Technology Stack

Technology Purpose
C++ Core application logic
OOP Encryption/decryption modeled as classes
Files Reading and writing cipher data
Git Version control
GitHub Hosting and collaboration

Project Structure

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

Class Architecture

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
Loading

Getting Started

Prerequisites

g++ C++17

Compilation

g++ src/main.cpp src/menu.cpp src/encryption.cpp src/decryption.cpp -Iinclude -o CaesarCipher.exe

Run

Linux / macOS
./CaesarCipher.exe
Windows
CaesarCipher.exe

Live Demo Preview

How It Works

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]
Loading
  1. Launch the application and choose an option from the menu — Encrypt, Decrypt, or Exit.
  2. Enter a numeric shift value to define the cipher key.
  3. The program reads source text from data/input.txt.
  4. Encrypted output is written to data/encrypted.txt.
  5. Decrypted output is written to data/decrypted.txt.

Example Walkthrough

Stage Value
Input Hello World
Shift Key 3
Encrypted Output Khoor Zruog
Decrypted Output Hello World

Concepts Demonstrated

Classes Headers Files Strings Menu Validation Cipher


Roadmap

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

Contributing

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

Author



BS Computer Science Student

GitHub



If this project helped you, consider giving it a star

Star this repo

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages