How mrmlik12/steganography-cpp works
Main Components
• CLI Module: This is responsible for parsing command-line arguments and providing helper functions (see include/cli and src/cli). It routes the user commands such as “check”, “encrypt”, “decrypt” to the appropriate processing modules.
• File Management Module: Located in include/file and src/file, it’s in charge of file-related functions (e.g., reading file metadata and verifying file validity).
• Image Processing Module: This core part of the application (found in include/image and src/image) manages image-specific tasks, including:
• Pixel manipulation (include/image/pixel and corresponding src/image/pixel.cpp)
• Handling different image formats (BMP and PPM) with specialized sub-modules (include/image/formats and src/image/formats). Each format (bmp, ppm) implements its own logic for embedding or extracting the hidden text.
• Main Control: The main entry point (src/main.cpp) orchestrates the overall workflow by integrating inputs from the CLI and delegating tasks to the file and image modules.
Establish Relationships and Interactions
• The CLI module serves as the front door: it accepts user input, validates commands, and directs the flow.
• The CLI interacts with the File Management module to retrieve details about the image (e.g., file information, check capacity for message embedding).
• Once file validation is done, the CLI invokes the Image Processing module—choosing the correct format-specific routines (BMP or PPM) based on the image file type.
• The Image Processing module then operates on the image’s pixel data. It collaborates with helper components (found in both include/cli/helpers.h, include/file/helpers.h, and include/image/helpers.h) to perform the LSB-based steganography operations.
Architectural Patterns and Design Principles
• Layered/Modular Architecture: The clear separation among CLI handling, file operations, and image processing modules simplifies understanding and potential future extensions.
• Separation of Concerns: Each directory and module focuses on a single responsibility – argument parsing, file I/O, image data manipulation, or format-specific operations.
• Reusability: Helper files and shared constants (like include/consts.h) indicate that drilling down specific tasks into re-usable functions is a priority.
Incorporate Relevant Technologies
• C++20 – emphasizing modern C++ features.
• CMake – used to build and manage the compilation process.
Step-by-Step Creation
a. Start by sketching a high-level view where the “User” sends commands into the “CLI Module”.
c. “Main Control” as the container that initializes and ties together these modules.
d. Error handling or validation flows where the file’s properties are checked to ensure that the text can be embedded.