Question: In your third project, you will be writing a pair of steganography programs that will hide and extract data from images. There are two parts

In your third project, you will be writing a pair of steganography programs that will hide and extract data from images. There are two parts to this project: First Part In the first part, you will write a program (Stego) that will hide a binary file in a PGM formatted image. PGM files are grayscale images that encode each pixel as an 8-bit value, ranging between 0 (0x00) and 255 (0xFF). The value 0x00 represents a black pixel and 0xFF is a white pixel. The trick to hiding data inside of a picture is to change the least significant bit (LSB) of each pixels byte. For example, if the original pixel has the value of 0xAE (10101110), we can encode a one in the LSB to turn it into 0xAF (10101111). The difference in color and brightness between a pixel with the value 0xAE and 0xAF is so tiny that a human would not see any difference! Steganography is hiding data in a way that you cant even tell anything is hidden in there. In this first part of the project, you will be hiding a binary data file in the least significant bit of each byte of the PGM image. The binary file you are hiding is known as the payload, the original image is the cover, and the modified PGM image that contains your payload is called the stego image. Second Part In the second part of your project, you will write a program StegoExtract that will take the stego image generated from the program you wrote for part one and extract the payload from it. Once the binary file is recovered, it will be identical to the original payload file. Since we are working with binary data files for the payload, the type can be any file that will fit. As long as it is small enough, you can encode other images into this image, in addition to encoding text files. 2.1 Starting Files For this project, we are providing five files that will be used as the starting point for this project: image.c This provides all of the functions to read and write to PGM images. image.h Header for image.c with all of the macros and prototypes you need. Stego.c // Starter File for Part One StegoExtract.c // Starter File for Part Two http://cs.gmu.edu/~zduric/cs262/Homeworks/half.pgm cs262.pgm image.c Contains several functions for reading and writing PGM and PPM images and binary files. Several macros, and examples of their use, have also been provided in this file to simplify image byte manipulation. GetGray(i) This macro will get and return byte i from the source image as an unsigned char. SetGray(i,g) This macro will set byte i in the destination image with the unsigned char g. GetByte(i) This macro will get and return byte i from the input binary data file. SetByte(i,val) This macro will set byte i in the output binary file to unsigned char val. Look at the definition of the macros provided in image.h to see how they affect the files in Stego.c Stego.c Starting point for Part One of your project. This will be the main source file for your program to embed a binary data file within a PGM image. Comments have been added to direct your solution. 2.2 Stego.c Design There are three parts to embedding data within the cover image. 1. You will use the first 32-bytes of the cover image to embed the 32-bits of b.size (the size field for the binary data file (payload)). You have access to this in Stego.c. Hint: GetGray(0); will get the first byte of the cover image and SetGray(0, b0); will replace it with b0 2. The second 32-bytes of the cover image will be used to embed the 8 digits of your G# in numerical form (using 4-bits per digit). 3. After this, you will embed each byte of your data into the LSBs of the cover image. This means you will be using 8 bytes of the image to hold each 1 byte of your information. This will use 8 * b.size bytes in total to embed the data (b.data) Hint: GetByte(0) gets the first byte of the payload data file, and SetByte(0, b0) will replace it with b0 Note that you can get and set image bytes and binary data using the provided macros. Unless you get really ambitious and want to play with color images (PPM format images), you only need to use the macros: GetGray, SetGray, and GetByte. The skeleton program (Stego.c) can be used to understand the operation of the macros and functions. You will be adding the main code for you solution to the following areas: // embed four size bytes for the Buffer s size field

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!