Skip to content

Yashasm18/StegaCrypt

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

1 Commit
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ” StegaCrypt β€” Hide Secrets in Plain Sight

A Steganography Tool that hides secret messages inside ordinary images using LSB (Least Significant Bit) Encoding. The image looks completely normal β€” but it carries a hidden message inside its pixels.


πŸ€” What is Steganography?

Steganography is the practice of hiding secret information inside ordinary-looking data. Unlike encryption (which scrambles data), steganography makes the message invisible. The encoded image looks identical to the original β€” the color changes by at most Β±1 per pixel, which is completely undetectable to the human eye.


🎯 How It Works

Step What Happens
1️⃣ Your secret message is converted to binary (0s and 1s)
2️⃣ Each pixel's RGB values are read as 8-bit binary numbers
3️⃣ The Least Significant Bit of each color channel is replaced with a message bit
4️⃣ The modified image is saved β€” it looks identical but carries your secret
Original pixel:  R = 11010110 (214)   G = 10110001 (177)   B = 01001110 (78)
Message bits:    0, 1, 0
Modified pixel:  R = 11010110 (214)   G = 10110001 (177)   B = 01001110 (78)
                         ↑ LSB                ↑ LSB                ↑ LSB

πŸ› οΈ Core Java Concepts Used

This project demonstrates 12 Core Java concepts:

Concept Implementation
OOP Classes, Objects β€” StegoImage, SecretMessage, LSBSteganography
Abstraction SteganographyEngine interface
Polymorphism SteganographyEngine engine = new LSBSteganography()
Encapsulation Private fields, public getters/setters
Inheritance StegoException extends Exception
Bit Manipulation AND (&), OR (|), SHIFT (>>, <<) operators
File I/O ImageIO.read(), ImageIO.write(), BufferedImage
Collections ArrayList, HashMap for pixel data and stats
Exception Handling Custom StegoException with error type Enum
Multithreading SwingWorker for background encoding/decoding
Swing GUI JFrame, JPanel, JTabbedPane, JFileChooser, event listeners
Enums ErrorType enum for categorizing exceptions

πŸ“ Project Structure

StegaCrypt/
β”œβ”€β”€ java/                              # Core Java PBL Code
β”‚   └── src/stegacrypt/
β”‚       β”œβ”€β”€ Main.java                  # Entry point
β”‚       β”œβ”€β”€ model/
β”‚       β”‚   β”œβ”€β”€ StegoImage.java        # Image model
β”‚       β”‚   └── SecretMessage.java     # Message model
β”‚       β”œβ”€β”€ core/
β”‚       β”‚   β”œβ”€β”€ SteganographyEngine.java  # Interface (Abstraction)
β”‚       β”‚   β”œβ”€β”€ LSBSteganography.java     # Algorithm (Polymorphism)
β”‚       β”‚   └── StegoException.java       # Custom Exception
β”‚       β”œβ”€β”€ util/
β”‚       β”‚   β”œβ”€β”€ BitManipulator.java    # Bit operations
β”‚       β”‚   └── ImageProcessor.java    # File I/O
β”‚       └── gui/
β”‚           └── StegaCryptGUI.java     # Swing GUI
β”‚
β”œβ”€β”€ web/                               # Web Demo (deployed on Vercel)
β”‚   β”œβ”€β”€ index.html
β”‚   β”œβ”€β”€ style.css
β”‚   └── app.js
β”‚
└── README.md

πŸš€ How to Run

Java (Desktop GUI)

cd java
javac -d out src/stegacrypt/util/*.java src/stegacrypt/core/*.java \
      src/stegacrypt/model/*.java src/stegacrypt/gui/*.java src/stegacrypt/Main.java
java -cp out stegacrypt.Main

Web Demo (Local)

cd web
npx serve . -l 3000
# Open http://localhost:3000

πŸ“Έ Screenshots

Encode Mode

Upload any image β†’ Type a secret message β†’ Download the encoded image

Decode Mode

Upload the encoded image β†’ Reveal the hidden message


🧠 Key Algorithm β€” LSB Encoding

// Set the Least Significant Bit
int modified = (value & 0xFE) | messageBit;
// 0xFE = 11111110 β†’ clears the last bit
// Then OR with our message bit (0 or 1)

Each pixel stores 3 bits of the message (one in R, G, B). A 1024Γ—1024 image can hide ~390,000 characters β€” an entire novel!


πŸ“„ License

This project is built for educational purposes as a Core Java PBL Project.

About

πŸ” A Core Java steganography tool that hides secret messages inside images using LSB encoding. Includes a live web demo.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors