Question: The problem Writing a simple steganography program in C, called steg. steg can operate in two modes encode and decode selected by the first command-line

The problem

Writing a simple steganography program in C, called steg. steg can operate in two modes encode and decode selected by the first command-line argument being e or d. An RGB colour bitmap image consists of a grid of pixels, each of which has red, green and blue colour values. To encode text inside an image, your program will replace the red value in successive random pixels in the image with characters from the text, outputting a new image. When encoding, your program will be invoked as: ./steg e old.ppm >new.ppm It must prompt for a message to encode, and output the new image to stdout (in this case we have redirected it to a file). To decode the text, your program will compare the new image with the old image, and extract characters from the new one where it differs from the old one. When decoding, your program will be invoked as: ./steg d old.ppm new.ppm It must decode the message and output the hidden text to stdout.

The PPM image format You will work with Plain PPM format images. This is one of a family of simple open source image formats, designed to be read and written easily by C programs. See the PPM specification for full details of PPM and Plain PPM. A Plain PPM file consists of ASCII text: P3 # comment1 # ... # commentN width height max r1 g1 b1 r2 g2 b2 r3 g3 b3 ...

Requirements

1 - (2 points) Storing PPM images In steg.c, complete the declaration of struct PPM, which holds the image read from a PPM file. This will need to include the information from the PPM header (width, height, max), and a pointer to a dynamically-allocated array containing the pixel data. Your program should be able to deal with PPM files with arbitrary numbers of rows and columns.

======================================================================================

#include

#include

#include

#include

/* The RGB values of a pixel. */

struct Pixel {

int red;

int green;

int blue;

};

/* An image loaded from a PPM file. */

struct PPM {

/* TODO: Question 1 */

};

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!