Steganography
Hide secret text data inside images using LSB encoding.
Steganography hides secret text inside images using LSB encoding — "Hide secret messages inside images using LSB encoding." An Encode/Decode toggle switches the card's whole flow (toggling clears state), and the dropzone label changes with mode: "Click or drag to upload an image to hide a message in" for encode, or "...a stego image to decode" for decode. In Encode mode, type a "Secret Message" and click "Hide Message"; progress streams as "Encoding... {n}%".
Success shows a banner "Message hidden successfully! ({n} chars)" plus "Result Size" and "Dimensions" stats, then "Download Stego Image". Decode mode's "Decode Message" either reports "Message found!" with the payload under "Decoded Message:" and a "Copy Message" button, or warns "No hidden message detected in this image". Capacity is roughly floor(pixels × 3 / 8) characters — only R, G, B channels are written; output is always PNG so lossy compression can't corrupt the bits. All local; no network, no AI.
How it works
lib/imageSteganography.ts converts text to 8-bit binary, then encode writes the least significant bit of the R, G, and B channels per pixel ((channel & 0xFE) | bit) until an 8-zero-bit null terminator is appended. Capacity is maxBits = (data.length/4)*3; exceeding it throws "Message too long. Max {floor(maxBits/8)} characters, got {len}". Decode reconstructs LSBs across R,G,B, scans for a 00000000 byte boundary, and converts back to a string.
Output is always PNG — lossy formats would destroy the LSBs. Progress callbacks report 10/30/50/80/100 through Redux steganographySlice (item, encodeResult, decodeResult, progress, isProcessing). No third-party libs: pure Canvas ImageData LSB manipulation, fully offline.
How to use
- Pick mode with the Encode / Decode toggle (switching clears current state).
- Drop a source image (encode) or a previously encoded PNG (decode).
- Encode: type into "Secret Message" (placeholder "Enter the message to hide...") — Decode: skip to step 5.
- Encode: click "Hide Message" and watch "Encoding... {n}%" progress.
- Decode: click "Decode Message" and read either "Message found!" or "No hidden message detected in this image".
- Encode: confirm the banner "Message hidden successfully! ({n} chars)" and note "Result Size" / "Dimensions".
- Encode: click "Download Stego Image"; Decode: click "Copy Message" as needed.
- Click "Start Over" to reset (also fires on mode switch).
Tips
- Always keep the stego output as PNG — JPEG re-compression will flip LSBs and corrupt the hidden payload.
- Capacity ≈ (width × height × 3 bits) / 8 characters (three LSB channels; alpha is untouched).
- Decode only works on images produced by this tool (same LSB order and null terminator).
- Messages are plain 8-bit text (charCodeAt) — steganography hides bits, it does not encrypt them.
Steganography FAQ
How much text fits?
Up to floor(pixels × 3 / 8) characters; past that the lib throws "Message too long. Max N characters, got M".
Why must the result be PNG?
Encoding writes lossless pixels; lossy compression would flip the LSBs and break the payload.
Can I decode any random photo?
You'll get "No hidden message detected in this image" unless a null-terminated LSB payload from this tool is present.
Is this encryption?
No — bits are hidden (steganography), not encrypted; anyone with this tool can decode a payload it wrote.
Does the alpha channel store data?
No — only the R, G, and B channels are written; alpha is left untouched.
Credits
- Canvas ImageData — LSB bit-packing across R, G, B channels