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.
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.
| 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
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 |
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
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.Maincd web
npx serve . -l 3000
# Open http://localhost:3000Upload any image β Type a secret message β Download the encoded image
Upload the encoded image β Reveal the hidden message
// 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!
This project is built for educational purposes as a Core Java PBL Project.