A Python-based steganography tool to hide and reveal secret messages in images using LSB (Least Significant Bit) encoding with optional XOR encryption.
- 🔐 Hide secret messages inside images
- 🔓 Reveal hidden messages
- 🔑 Optional password-based XOR encryption
- 🧩 Simple command-line interface
- 🧪 Custom EOF marker to detect message boundaries
- ✅ PNG (recommended – lossless and ideal for steganography)
⚠️ JPG/JPEG (not recommended – lossy compression may corrupt hidden data)- ✅ Other formats like BMP, GIF may work, but are not officially tested
🔍 Tip: Always use lossless formats like PNG to preserve hidden data integrity.
stegano/ ├── main.py ├── hide_data.py # Hide message into image ├── reveal_data.py # Reveal hidden message ├── utils.py # Encryption helper (SHA-256 + Fernet - currently unused) ├── flower.png # Sample input image ├── hidden.png # Image with hidden message (output)
- Input an image (e.g.,
flower.png) - Provide a secret message and optional password
- The message is XOR-encrypted (if password is set)
- The message is converted to binary
- Each bit is embedded into the LSB of RGB pixel values
- A custom EOF marker (
10101010101010101111100011110000) is appended - Result: A new image (e.g.,
hidden.png) with the secret message
- Input the image containing the hidden message
- Extract binary data from the LSBs of pixel colors
- Locate the EOF marker
- Convert binary to text
- If password is provided, XOR-decrypt the message
Install the required dependencies:
pip install pillow cryptography
▶️ Run the Tool
bash
python main.py
🧭 Menu Options
1️⃣ Hide a Message
Input image filename (e.g., flower.png)
Output image filename (e.g., hidden.png)
Secret message
Password (optional)
2️⃣ Reveal a Message
Input image with hidden message (e.g., hidden.png)
Password (if one was used during hiding)
🧪 Example
Hiding
bash
python main.py
Choose option 1
Image: flower.png
Output: hidden.png
Message: Hello World!This is Medha.
Password: swaraj@123
Revealing
bash
python main.py
Choose option 2
Image: hidden.png
Password: swaraj@123
Output:
scss
🔓 Hidden message: Hello World!This is Medha.
🛡️ Security Note
This toolkit uses XOR encryption, which is simple and not secure for serious use.
A stronger encryption option using Fernet (AES) exists in utils.py, but is not currently integrated into the main workflow.
👩💻 Author
Medha Swaraj
Cybersecurity Internship,2025