Skip to content

Khush0031/EncryptorDecryptor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

EncryptorDecryptor

A simple C++ console application to encrypt and decrypt files using a password.

Features

  • File Encryption: Encrypts any file using a custom password
  • File Decryption: Decrypts previously encrypted files
  • Algorithm: Uses a combination of XOR encryption and bitwise rotation for basic data obfuscation

Project Structure

EncryptorDecryptor/
├── CMakeLists.txt              # CMake build configuration
├── configuration/
│   ├── build.bat              # Build script
│   └── run.bat                # Run script
├── artifacts/     
│   └── clean.bat              # Clean build files
└── src/
    ├── main.cpp               # Main program entry point
    ├── CryptoUtils.cpp        # Key generation utilities
    ├── CryptoUtils.h
    ├── Encryptor.cpp          # Encryption/decryption logic
    ├── Encryptor.h
    ├── FileManager.cpp        # File I/O operations
    └── FileManager.h

Prerequisites

Quick Start

Build the Project

From the project root directory:

configuration\build.bat

This will:

  1. Check for CMake and g++ compiler
  2. Create a build directory
  3. Configure the project with CMake
  4. Compile the source code
  5. Generate executable at build/bin/EncryptorDecryptor.exe

Run the Application

configuration\run.bat

Or directly:

build\bin\EncryptorDecryptor.exe

Clean Build Files

artifacts\clean.bat

Manual Build Commands

Using CMake (Recommended)

# Create and enter build directory
mkdir build
cd build

# Configure project
cmake .. -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE=Release

# Build
cmake --build . --config Release

# Return to root
cd ..

# Run
build\bin\EncryptorDecryptor.exe

Using g++ Directly

# Create build directory
mkdir build

# Compile
g++ -std=c++17 -O2 -Wall -Wextra -I./src ^
    src/CryptoUtils.cpp ^
    src/Encryptor.cpp ^
    src/FileManager.cpp ^
    src/main.cpp ^
    -o build/EncryptorDecryptor.exe

# Run
build\EncryptorDecryptor.exe

How to Use

  1. Run the executable:

    build\bin\EncryptorDecryptor.exe
  2. Choose operation:

    1. Encrypt File
    2. Decrypt File
    Choice: 1
    
  3. Provide file paths:

    Input File: document.txt
    Output File: document.txt.enc
    Password: mySecretPassword123
    
  4. Success message:

    Operation successful.
    

Example: Encrypt a File

build\bin\EncryptorDecryptor.exe
1                          # Choose encrypt
myfile.txt                 # Input file
myfile.encrypted          # Output file
myPassword123             # Password

Example: Decrypt a File

build\bin\EncryptorDecryptor.exe
2                          # Choose decrypt
myfile.encrypted          # Input file
myfile_decrypted.txt      # Output file
myPassword123             # Same password used for encryption

Build Configuration

The project uses CMake with the following settings:

  • C++ Standard: C++17
  • Compiler Warnings: Enabled (-Wall -Wextra -Wpedantic)
  • Build Type: Release (optimized)
  • Output Directory: build/bin/

Troubleshooting

"CMake not found"

"g++ not found"

  • Install MinGW-w64
  • Add MinGW bin folder to system PATH (e.g., C:\mingw64\bin)
  • Restart terminal/command prompt

"Failed to open file for reading"

  • Check if input file exists
  • Verify file path is correct
  • Ensure you have read permissions

"Failed to open file for writing"

  • Check if output directory exists
  • Verify you have write permissions
  • Ensure output file is not open in another program

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published