Skip to content

A robust steganography tool designed to hide text within images in a way that survives social media platform processing, including JPEG recompression.

License

Notifications You must be signed in to change notification settings

Iman/javid-steganography

Repository files navigation

Javid Steganography

A robust steganography toolkit for hiding text or images within images, designed to survive social media platform processing.

نسخه فارسی (Persian Version)

Tools Available

Tool Hides Pixel Modification Survives Recompression
text-image-simple.py Text No No
text-image-advance.py Text Yes (ROBUST method) Yes
image-to-image-simple.py Image No No

text-image-simple.py

  • Hides text in file structure (no pixel changes)
  • PNG: DEFLATE stream in IDAT chunk
  • JPEG: Comment marker (COM segment)
  • Best for: Document sharing, X.com PNG posts

text-image-advance.py

  • Includes simple methods plus ROBUST method
  • ROBUST: Block-based luminance encoding with error correction
  • Survives JPEG quality 70+ recompression
  • Best for: Photo sharing on WhatsApp/Telegram

image-to-image-simple.py

  • Hides an entire image inside another image
  • Compressed (zlib) + encrypted payload
  • PNG: Appended to DEFLATE stream
  • JPEG: Appended after EOI marker
  • Best for: Document sharing only

Features

  • Encrypted payloads: PBKDF2 key derivation with XOR cipher
  • Integrity verification: CRC32 checksum
  • Compression: zlib compression for image-in-image
  • Error correction: Hamming(7,4) code with 3x redundancy (ROBUST)
  • Unicode support: Full UTF-8 including Persian, Arabic, and other scripts
  • Max capacity: 500 characters (text) or limited by file size (images)

Installation

git clone git@github.com:Iman/javid-steganography.git
cd javid-steganography
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate
pip install -r requirements.txt

Usage

Simple Tool (Document Sharing)

# Hide in PNG (DEFLATE method)
python text-image-simple.py hide "Secret message" password123 input.png output.png

# Hide in JPEG (Comment marker)
python text-image-simple.py hide "Secret message" password123 input.jpg output.jpg

# Extract
python text-image-simple.py show password123 stego.png
python text-image-simple.py show password123 stego.jpg

Advanced Tool (Photo Sharing)

# DEFLATE method (PNG, for X.com)
python text-image-advance.py hide "Secret message" password123 input.png output.png

# ROBUST method (survives recompression)
python text-image-advance.py hide "Secret message" password123 input.jpg output.jpg robust

# Extract
python text-image-advance.py show password123 stego.png
python text-image-advance.py show password123 stego.jpg

Image-in-Image Tool (Document Sharing)

# Hide an image inside another image
python image-to-image-simple.py hide cover.jpg secret.jpg output.jpg password123

# Extract hidden image
python image-to-image-simple.py show stego.jpg extracted.jpg password123

Methods

DEFLATE Method (PNG)

Appends encrypted data to the DEFLATE stream inside IDAT chunks. Suitable for platforms that do not re-encode PNG files meeting certain criteria (file size < width × height bytes).

Best for: X.com (Twitter), sending as documents

ROBUST Method (JPEG/PNG)

Uses block-based luminance encoding with error correction. Modifies pixel luminance in 8×8 blocks to encode bits, surviving JPEG recompression.

Best for: WhatsApp photos, Telegram photos, any platform with JPEG recompression

Platform Compatibility

Summary Table

Platform Send Mode Format Tool Method Survives Notes
X.com Post PNG simple/advance DEFLATE Yes filesize < width×height bytes
X.com Post JPEG advance ROBUST Yes Quality ~85 recompression
X.com DM PNG simple/advance DEFLATE Yes Same as post
WhatsApp Document PNG simple/advance DEFLATE Yes No processing applied
WhatsApp Document JPEG simple COM Yes No processing applied
WhatsApp Photo PNG advance ROBUST Yes Converted to JPEG ~70
WhatsApp Photo JPEG advance ROBUST Yes Recompressed ~70
Telegram Document PNG simple/advance DEFLATE Yes No processing applied
Telegram Document JPEG simple COM Yes No processing applied
Telegram Photo PNG advance ROBUST Yes Recompressed
Telegram Photo JPEG advance ROBUST Yes Quality ~82, max 2560px

Platform-Specific Requirements

Platform Max Resolution Max File Size Compression Quality
X.com 4096×4096 5MB (PNG), 5MB (JPEG) ~85
WhatsApp 1280×1280 (photo) 16MB (document) ~70
Telegram 2560×2560 (photo) 2GB (document) ~82

Recommended Tool by Use Case

Use Case Tool Method Format
X.com posts (text) text-image-simple DEFLATE PNG
WhatsApp photo sharing (text) text-image-advance ROBUST JPEG
WhatsApp document sharing (text) text-image-simple DEFLATE/COM PNG/JPEG
Telegram photo sharing (text) text-image-advance ROBUST JPEG
Telegram document sharing (text) text-image-simple DEFLATE/COM PNG/JPEG
Hide image in image (document) image-to-image-simple Append PNG/JPEG
Maximum text compatibility text-image-advance ROBUST JPEG
Maximum text capacity text-image-simple DEFLATE PNG
No pixel changes needed text-image-simple DEFLATE/COM PNG/JPEG

Limitations

  • Maximum 500 characters per image (text tools)
  • ROBUST method requires larger images for longer messages
  • DEFLATE method only works with PNG files
  • Image-to-image only works when sent as document (no recompression)
  • Extraction requires the same password used for embedding

Technical Details

  • Encryption: PBKDF2-HMAC-SHA256 (100,000 iterations) + XOR cipher
  • Integrity: CRC32 checksum verification
  • Error correction: Hamming(7,4) encoding
  • Redundancy: 3x bit replication with majority voting
  • Block encoding: Centre vs edge luminance differential (strength: 25)

Quick Start Guide (Examples for Beginners)

Scenario 1: Hide a secret message and send via WhatsApp/Telegram as DOCUMENT

Step 1: Hide your message

python text-image-simple.py hide "Meet me at 5pm" mypassword photo.jpg secret_photo.jpg

Step 2: Send secret_photo.jpg as a DOCUMENT (not photo) on WhatsApp/Telegram

Step 3: Recipient extracts the message

python text-image-simple.py show mypassword secret_photo.jpg

Output: Message: Meet me at 5pm


Scenario 2: Hide a secret message and send via WhatsApp/Telegram as PHOTO

Step 1: Hide your message (uses ROBUST method)

python text-image-advance.py hide "Meet me at 5pm" mypassword photo.jpg secret_photo.jpg robust

Step 2: Send secret_photo.jpg as a normal photo on WhatsApp/Telegram

Step 3: Recipient saves the photo and extracts

python text-image-advance.py show mypassword secret_photo.jpg

Output: Message: Meet me at 5pm


Scenario 3: Hide a secret message and post on X.com (Twitter)

Step 1: Hide your message in PNG

python text-image-simple.py hide "Secret message here" mypassword photo.png secret_photo.png

Step 2: Post secret_photo.png on X.com

Step 3: Anyone with password downloads image and extracts

python text-image-simple.py show mypassword secret_photo.png

Scenario 4: Hide an image inside another image

Step 1: Hide secret image inside cover image

python image-to-image-simple.py hide cover.jpg secret.jpg output.jpg mypassword

Step 2: Send output.jpg as DOCUMENT (not photo)

Step 3: Recipient extracts the hidden image

python image-to-image-simple.py show output.jpg extracted_secret.jpg mypassword

Scenario 5: Hide message in multiple languages (Unicode)

python text-image-simple.py hide "Hello سلام 你好 مرحبا" mypassword photo.jpg secret.jpg

Extract:

python text-image-simple.py show mypassword secret.jpg

Output: Message: Hello سلام 你好 مرحبا


Common Mistakes to Avoid

Mistake Problem Solution
Sending as photo with simple tool Data destroyed by recompression Use text-image-advance.py with robust flag
Wrong password Extraction fails Use exact same password
Forgetting file extension Wrong format used Always include .jpg or .png
Message too long Embedding fails Keep under 500 characters
Image too small for ROBUST Not enough capacity Use larger cover image

Which Tool Should I Use?

Do you need to send as PHOTO (not document)?
├── YES → Use text-image-advance.py with "robust" flag
└── NO (sending as document) → Use text-image-simple.py

Are you hiding an image (not text)?
├── YES → Use image-to-image-simple.py (document only)
└── NO → Use text tools above

License

MIT License

About

A robust steganography tool designed to hide text within images in a way that survives social media platform processing, including JPEG recompression.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages