Exercise # 2

In this lab, you have to finish the first program and show it to the instructor. You can start in the second, probably you will not be able to finish it, but you can finish it after the lab.

1-Write a small C program to read two lines of input from the standard input and displays the line that would come first in alphabetical order. The lines are either characters or spaces (no digits, commas, periods, ....).

 

2- Steganography is the science/art of hiding a message in such a way that only the sender and intended receiver can read it. Ancients greeks used to shave the heads of soldiers, tattoo the message on the skull, and then the hair growth will hide it. Modern steganography usually hide messages in image files where if the data hidden small enough (or carefully hidden) that might not affect the quality of the image. Any person will check the file will see a regular image file.

In this exercise, you will hide a small message in a file that is called data.txt in the file homer.gif. Create a file called data.txt that contains the phrase "this is the data to be hidden". Then open the file hoer.gif, open another file homer1.gif and hide the message in the second file. Consider the following cases.

First, add the message to the end of the file. That is copy homer to homer1, then append the message to the end of the file homer1. What is he effect on the quality of the picture?

Second, the drawback of the previous method, is that it increases the size of the file. That could be one indicator that the file contains some encrypted data. Hide the data in the file such that the size of homer1 is the same as homer. That is replace some bytes of the original file with the hidden message. Since you do not know exactly what is the format of the file homer.gif. The beginning of the file might contain some information about the format, or size of the file. Corrupting this data might lead to a corrupt image file. So save the message somewhere in the middle of the file (try after the first 1000, and 2000 bytes of the file). What is the effect on the quality of the picture?