How rishi-269/pixelhide works
1. Pixel Hide is a single native C++17 command-line binary, not a service or library stack. The architecture is centered on one executable that orchestrates steganography and optional encryption over local files.
2. The top-level entry point is main.cpp. It is the CLI boundary: parses modes like help, key generation, insert, and retrieve, then dispatches into the lower-level image, file, and crypto routines.
3. The core steganography subsystem lives in image.cpp/.hpp. This is where image data is loaded, modified, and written back out. The README makes clear the hidden-data mechanism is LSB-based, so the image layer is responsible for mapping payload bits into pixel channels and reconstructing them during extraction.
4. Image I/O is built on vendored stb_image.h and stb_image_write.h under stb/. These headers form the format-handling boundary for reading common inputs like PNG/JPG/BMP and writing only lossless outputs such as PNG/BMP, which matters because lossy output would destroy embedded bits.
5. Payload and key handling are separated into file.cpp/.hpp. This module likely owns file reads/writes, payload size handling, and key file generation/storage, keeping file-system concerns out of the image codec path.
6. Optional encryption is handled by vendored tiny-aes/aes.c/.h. The README states AES in CTR mode, so the data flow is: plaintext file content is optionally encrypted before embedding, and decrypted after extraction if a key is provided.
7. The main runtime flow for insertion is: read input file content, optionally encrypt it, serialize metadata plus payload, embed the resulting bitstream into image pixels, then write a new steganographic image. The output image is the primary artifact produced by the tool.
8. The retrieval flow is the inverse: load the stego image, extract the hidden bitstream from pixel LSBs, parse out the embedded payload, and optionally decrypt it using the provided key. The final output is the recovered file bytes written back to disk.
9. The important architectural boundary is between “carrier processing” and “payload processing.” Image manipulation is isolated from file/encryption logic, which keeps the stego algorithm independent from format-specific details and from cryptographic details.
10. This repo has no network layer, no database, and no background workers. The entire system is local, file-driven, and deterministic, with external dependencies limited to vendored image codecs and AES implementation code.
11. For an architecture diagram, the key nodes are: CLI entry point, file/payload manager, optional AES-CTR encrypt/decrypt module, LSB embedding/extraction engine, and image codec layer. The main arrows are from CLI to processing modules, then from input files/images into the pipeline, and finally to output image/file artifacts.
Main entry points: image.cpp image.cpp · file.cpp file.cpp · main.cpp main.cpp · aes.c AES CTR
Components 12
CLI
Command-line entry and orchestration
- main.cpp · Parses modes and dispatches insert/retrieve/key flows
main.cpp
Payload
File handling and optional encryption
- file.cpp · Reads payload bytes, manages keys, and writes recovered output
file.cpp - Input file · Plaintext payload read from disk before embedding
- Key file · Generated or supplied key material for encryption
- Hidden stream · Serialized metadata and payload bytes prepared for LSB embedding
- Recovered file · Extracted payload bytes written back to disk
Carrier
Image loading, bit embedding, and writing
- image.cpp · Embeds and extracts hidden data in image pixels
image.cpp - Carrier image · Cover image loaded for steganographic modification
- Stego image · Modified image written with embedded payload bits
Connections 15
- main.cpp → file.cpp: dispatches · Routes CLI commands to file and key operations
- main.cpp → image.cpp: dispatches · Routes insert and retrieve actions into stego processing
- main.cpp → AES CTR: uses · Wires optional encryption into the command flow
- file.cpp → Input file: reads · Loads payload bytes from local files
- file.cpp → Key file: creates/reads · Generates or opens key material
- file.cpp → Hidden stream: serializes · Packages payload and metadata for embedding
- AES CTR → Hidden stream: encrypts/decrypts · Transforms payload bytes when a key is provided
- image.cpp → Carrier image: loads · Reads the cover image into memory
- image.cpp → Hidden stream: embeds/extracts · Maps payload bits into or out of pixel channels
- image.cpp → Stego image: writes · Emits the modified image after insertion
- image.cpp → Recovered file: outputs · Passes extracted bytes to file writing logic
- image.cpp → stb_image: decodes with · Uses vendored loader for input formats
- image.cpp → stb_write: encodes with · Uses vendored writer for output formats
- Hidden stream → Stego image: becomes · Embedded data is persisted inside the carrier output
- Hidden stream → Recovered file: restores · Extracted stream is converted back into file bytes