Skip to content

AlexBesios/CyberSecurityProject

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🔐 Message Encryptor/Decryptor

A modern, cross-platform GUI application for encrypting and decrypting messages using various cryptographic ciphers. Features a responsive design that works seamlessly across Windows, macOS, and Linux.

✨ Features

  • 🔒 Caesar Cipher: A substitution cipher that shifts letters by a fixed number of positions
  • 🔑 Vigenère Cipher: A polyalphabetic substitution cipher using a keyword
  • 🧮 Affine Cipher: A monoalphabetic substitution cipher with a mathematical function
  • 📐 Hill Cipher: A polygraphic substitution cipher based on linear algebra
  • 🔄 Substitution Cipher: A cipher that replaces each letter with a unique substitution
  • 🎲 One-Time Pad (OTP): A symmetric encryption algorithm using a random key

🎯 New Features in v2.0

  • Modern GUI: Beautiful, dark-themed interface using CustomTkinter
  • Cross-platform compatibility: Works seamlessly on Windows, macOS, and Linux
  • Enhanced security: Removed dangerous eval() calls with safe parsing functions
  • Better error handling: Comprehensive input validation and user-friendly error messages
  • Responsive design: Adaptive window sizing and layout
  • Multi-line text support: Text areas for longer messages
  • Keyboard shortcuts: Ctrl+Enter to perform actions, Ctrl+C to copy results
  • Copy to clipboard: Easy result copying functionality
  • Real-time help: Dynamic key format hints based on selected cipher
  • Status feedback: Real-time status updates and operation feedback

📋 Installation

Prerequisites

  • Python 3.8 or higher
  • Operating System: Windows 10+, macOS 10.14+, or Linux (Ubuntu 18.04+, etc.)

Quick Start

Option 1: Using Launcher Scripts (Recommended)

Windows:

# Double-click run.bat or run in Command Prompt:
run.bat

Linux/macOS:

# Make the script executable and run:
chmod +x run.sh
./run.sh

Option 2: Manual Setup

  1. Clone the repository:

    git clone https://github.com/AlexBesios/CyberSecurityProject.git
    cd CyberSecurityProject
  2. Create and activate virtual environment:

    Windows:

    python -m venv venv
    venv\Scripts\activate

    Linux/macOS:

    python3 -m venv venv
    source venv/bin/activate
  3. Install dependencies:

    pip install -r requirements.txt
  4. Run the application:

    python App.py

🚀 Usage

  1. Launch the application using one of the methods above
  2. Select a cipher from the dropdown menu
  3. Choose the action (Encrypt or Decrypt)
  4. Enter your message in the text area
  5. Enter the key according to the format hint shown
  6. Click "Perform" or press Ctrl+Enter
  7. Copy the result using the copy button or Ctrl+C

🔑 Key Formats for Each Cipher

Cipher Key Format Example
Caesar Integer 3
Vigenère Keyword (letters only) KEY
Affine Two integers separated by comma 5,8
Hill Square matrix in JSON format [[3, 2], [5, 7]]
Substitution Dictionary mapping {'a': 'm', 'b': 'n', 'c': 'o'}
OTP String (≥ message length) MYSECRETKEY

💡 Examples

Caesar Cipher

  • Message: Hello World!
  • Key: 3
  • Action: Encrypt
  • Result: Khoor Zruog!

Vigenère Cipher

  • Message: ATTACK AT DAWN
  • Key: LEMON
  • Action: Encrypt
  • Result: LXFOPV EF RNHR

Hill Cipher

  • Message: HELLO
  • Key: [[3, 2], [5, 7]]
  • Action: Encrypt
  • Result: dldck

🛠️ Technical Improvements

Security Enhancements

  • ✅ Removed dangerous eval() calls
  • ✅ Implemented safe JSON parsing for complex keys
  • ✅ Added comprehensive input validation
  • ✅ Enhanced error handling with specific error messages

Code Quality

  • ✅ Added type hints throughout the codebase
  • ✅ Improved code structure and modularity
  • ✅ Comprehensive documentation and comments
  • ✅ Added unit tests for all cipher functions

User Experience

  • ✅ Modern, intuitive interface design
  • ✅ Cross-platform compatibility
  • ✅ Responsive layout that adapts to screen size
  • ✅ Real-time help and feedback
  • ✅ Keyboard shortcuts for power users

🧪 Testing

Run the test suite to verify all cipher implementations:

python test_ciphers.py

📁 Project Structure

CyberSecurityProject/
├── App.py              # Main GUI application
├── Ciphers.py          # Cipher implementations
├── requirements.txt    # Python dependencies
├── test_ciphers.py     # Test suite
├── run.bat            # Windows launcher
├── run.sh             # Linux/macOS launcher
└── README.md          # This file

🔧 Dependencies

  • customtkinter: Modern GUI framework
  • numpy: Numerical operations for Hill cipher
  • Pillow: Image processing support
  • ttkthemes: Additional theme support

🐛 Troubleshooting

Common Issues

  1. "Module not found" errors

    • Ensure virtual environment is activated
    • Run pip install -r requirements.txt
  2. GUI doesn't appear on Linux

    • Install tkinter: sudo apt-get install python3-tk
    • Ensure X11 forwarding if using SSH
  3. Font rendering issues on Linux

    • Install DejaVu fonts: sudo apt-get install fonts-dejavu

🤝 Contributing

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature-name
  3. Make your changes
  4. Add tests for new features
  5. Run the test suite: python test_ciphers.py
  6. Commit your changes: git commit -am 'Add feature'
  7. Push to the branch: git push origin feature-name
  8. Create a Pull Request

📄 License

This project is open source and available under the MIT License.

👥 Authors

  • PhyniX - Initial development
  • AlexBesios - Enhancements and modernization

🙏 Acknowledgments

  • Thanks to the cryptography community for cipher algorithms
  • CustomTkinter team for the modern GUI framework
  • NumPy developers for numerical computation support

Made with ❤️ by PhyniX and AlexBesios

About

A cyber security project that explains some ciphers, encrypting and decrypting messages!

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors