Skip to content

Repository files navigation

🖼️ Image Cryptography Studio

Python Version NumPy Pillow License: MIT

An advanced, high-performance Python application designed for lossless image encryption and decryption using bitwise XOR operations. It includes robust metrics analysis tools, visual leakage evaluation, and batch empirical processing.


✨ Key Features

  • Lossless Cryptography: Direct bitwise XOR operations guarantee pixel-perfect reconstruction of decrypted images.
  • 📊 Empirical Metric Evaluator: Computes Shannon Entropy (average/channel-wise), contrast, and color complexity over image batches.
  • 🛡️ Visual Leakage Analyzer: Evaluates encryption quality differences when using simple keys vs. complex keys.
  • 📈 Flattest Histogram Verification: Measures uniformity standards to identify potential statistical vulnerabilities.

🚀 Quick Start & Installation

1. Clone & Setup Directory

git clone https://github.com/your-username/image-encryption.git
cd "Image encryption"

2. Install Dependencies

Ensure you have Python 3.8+ installed, then run:

pip install -r requirements.txt

Alternatively, install directly:

pip install numpy Pillow

3. Run the Studio

python main.py

🎮 Interactive Menu Options

When you launch main.py, you will be greeted with the following interactive modes:

Image Encryption
1. Single image encrypt/decrypt
2. Empirical Analysis Run
3. Demonstrate Visual Leakage
4. Exit

📊 Evaluation Metrics Explained

To ensure maximum cryptographic strength, the tool evaluates images using:

Metric Target / Optimal Value Purpose
Shannon Entropy $\approx 8.0$ (Max randomness) Measures how random/unpredictable the encrypted pixels are.
Histogram Uniformity Lower StdDev is better Indicates if pixel intensity frequencies are evenly distributed.
Color Complexity Match target profile Number of unique RGB colors present in the matrix.

🖼️ Results Showcase

Here is a visual demonstration of the encryption and decryption pipeline output:

🔒 Encrypted Output (encrypted_result.png) 🔓 Lossless Recovered Output (recovered_image.png)
Encrypted Result Recovered Image

🛠️ Tech Stack & Requirements

  • Language: Python 3.8+
  • Core Libraries: numpy, PIL (Pillow)
  • Math & Statistics: Normalized Histogram Analysis, Bitwise XOR Matrix Transformations

📄 License

Distributed under the MIT License. See LICENSE for more details.

About

Lossless image encryption/decryption utility using bitwise XOR

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages