Skip to main content

Professional Steganography tool with AES-GCM and Reed-Solomon ECC

Project description

steg

Advanced Image Steganography Tool

A secure command-line steganography tool written in Python that allows users to hide encrypted messages inside images using Least Significant Bit (LSB) steganography combined with AES-256 encryption.

Designed with a focus on stealth, integrity, and cryptographic security, this project demonstrates how modern cryptography and steganography can be combined to conceal information inside digital images with minimal visual distortion.


Overview

This tool allows you to:

  • Hide secret messages inside images
  • Encrypt messages before embedding them
  • Extract hidden messages using the correct password
  • Analyze image capacity and embedding density

Unlike simple steganography tools, this implementation encrypts the data before hiding it, adding a strong security layer.

Even if hidden data is detected, it cannot be decrypted without the correct password.


How It Works

The system operates in two main stages:


1. Encryption

Before embedding, the message is encrypted using:

  • AES-256 GCM (authenticated encryption)
  • PBKDF2 key derivation (600,000 iterations)
  • Random salt and nonce

Process:

  1. User provides message and password
  2. A cryptographic key is derived from the password
  3. Message is encrypted securely
  4. Encrypted data is prepared for embedding

2. Steganography (Randomized LSB Encoding)

The encrypted data is embedded using a password-seeded pseudo-random process:

  1. The password is hashed to generate a deterministic seed
  2. Pixel coordinates are shuffled based on that seed
  3. Data bits are scattered across the image in a non-linear pattern
  4. LSB Matching (Stealth Boost): Unlike standard LSB flipping, this tool uses LSB Matching. If the bit doesn't match, it randomly adds or subtracts 1 from the pixel value. This prevents the "Pairs of Values" (PoV) statistical signature that most steganography detectors look for.

This ensures the embedded data resembles natural noise and avoids detectable patterns.


Why Randomized LSB?

Sequential LSB encoding creates visible statistical patterns that can be detected using tools like StegSolve.

This implementation:

  • Breaks spatial patterns in embedded data
  • Distributes entropy across the entire image
  • Reduces effectiveness of statistical attacks (e.g., Chi-square analysis)

3. Coordinate Generation

The embedding path is determined by:

Path = Shuffle(Coordinates, Seed(Hash(Password)))

Without the correct password, reconstructing the embedding path is computationally infeasible.

This adds an additional obfuscation layer on top of AES-GCM encryption.


Visual Integrity

Original Image Stego Image (Encoded)
Original Encoded
0% Change ~0.01% LSB Change

Even under magnification, modifications remain imperceptible to the human eye.


Message Structure Inside Image

The embedded payload structure:

[32-bit mask][32-bit masked_length][salt][nonce][encrypted payload]

The payload length is XOR-masked to prevent straightforward extraction or pattern detection.


Image Capacity & Density Analysis

Before encoding, the tool evaluates:

  • Image dimensions
  • Total available LSB slots
  • Required bits for payload
  • Embedding density percentage

Example Output:

[*] Image Analysis:

Dimensions: 1920x1080
Total LSB Slots: 6220800
Required Bits: 1024
Stego Density: 0.0164%

If density exceeds safe thresholds, the tool warns about potential detectability.


Technologies Used

Technology Purpose
Python 3 Core programming language
Pillow (PIL) Image processing
cryptography library Encryption and key derivation
AES-256-GCM Authenticated encryption
PBKDF2HMAC Password-based key derivation
Reed-Solomon Error correction and integrity check
LSB Steganography Data embedding in image pixels

Installation

1. Clone the repository

git clone https://github.com/roodra-afk/steg

cd steg

2. Install dependencies

pip install -r requirements.txt

Usage

Run the tool via command-line arguments:


Encode a Message

python3 steg.py encode -i input.png -m "Secret message" -p "password" -o output.png

Decode a Message

python3 steg.py decode -i output.png -p "password"

Example

Encode:

python3 steg.py encode -i photo.png -m "This is classified" -p "myStrongPassword" -o hidden.png

Decode:

python3 steg.py decode -i hidden.png -p "myStrongPassword"

Security Features

  • AES-256-GCM authenticated encryption
  • PBKDF2 key derivation with 600,000 iterations
  • Reed-Solomon error correction
  • Password-seeded pixel shuffling
  • Channel-level randomization
  • Obfuscated payload length header
  • Density-based detectability warning

Limitations

  • Optimized for PNG images
  • Lossy formats (e.g., JPEG recompression) may destroy hidden data
  • Very large payloads increase detection risk
  • Requires correct password for both decoding and pixel mapping

Integrity Verification (Optional)

To verify that the stego image has not been altered:

sha256sum output.png

Any modification will likely corrupt the hidden payload.


Possible Improvements

Future enhancements could include:

  • GUI or web interface
  • Support for multiple file formats
  • File embedding (not just text)
  • Adaptive or edge-based embedding
  • Advanced steganalysis resistance techniques

⚠️ Disclaimer

This tool is intended for educational and research purposes only.
The author is not responsible for misuse. Always ensure proper authorization when working with data concealment techniques.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

stegx-0.1.0.tar.gz (7.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

stegx-0.1.0-py3-none-any.whl (7.6 kB view details)

Uploaded Python 3

File details

Details for the file stegx-0.1.0.tar.gz.

File metadata

  • Download URL: stegx-0.1.0.tar.gz
  • Upload date:
  • Size: 7.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.12

File hashes

Hashes for stegx-0.1.0.tar.gz
Algorithm Hash digest
SHA256 682f53e2a0023aafb500825a88905f10e38f7eee197e0980b19bef0e4d948757
MD5 a2b2e1cd954904ac8a04d7fe9b7714d0
BLAKE2b-256 2f5b33adc6c2acbc36425a7ce633966d4d9dd956b7b7487a76fc7828412bce6c

See more details on using hashes here.

File details

Details for the file stegx-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: stegx-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 7.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.12

File hashes

Hashes for stegx-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 14a28e96ad704166c1e630ad5d0a81f4cc32964734994e7a430f7e28ef7b398d
MD5 73c2a7db631cca330a021b993bd415e5
BLAKE2b-256 19fec0548c026c55435e19931958dfce15dc93a1a037bc26360f9c594d0bbe88

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page