I'm wondering if anyone can help me out. I have a program that I need done soon, and am wondering if anyone can either
a) Give me tips on how to complete it
b) Do it for me for a fee
Here's the program requirements:
People use cryptography to send secret messages to one another without a third party overseeing the message. Steganography is a type of cryptography in which the secret message is hidden in a digital picture. Think of all those pixels in an image and each pixel has three color numbers — there are zillions of numbers in an image. If you were to change a few of these color numbers the resulting picture would probably look a lot like the original image; in fact, most people probably couldn’t tell that you had changed the image at all. Steganography works by changing a few pixel color values; we will use selected pixel values to represent characters instead of a color value. Of course, the resulting image will still look mostly like the original except that a few tiny ”blips” might seem a little out of place if you look very closely. We can then send the image to a friend and they can extract the message if they know which pixels to decode.
In this part of the assignment you will be writing a java application that will enable you to exchange secret messages with another person. We will use our knowledge of pixel manipulation to implement a steganographic system.
Here are the requirements for this assignment:
First you will need to read your picture as a jpg and then save it in 24-bit bmp format. You will need to use bmp files for this assignment because jpg’s are ”lossy” meaning that what you write to the file may be changed slightly so that the resulting image can be stored more efficiently. Thus jpg will not work for steganography because jpgs will change the secret message when storing the file to disk. Here are the commands to save your file. You can give it the same name except be sure to put a .bmp file extension on the end. (For example, I loaded ”Mark.jpg” and then saved ”Mark.bmp”). You can use Microsoft Paint to do this conversion.
Create an application for implementing the steganography. Name your class Steganography (and thus name your file Steganography.java). Note that bmp files take a lot of memory. You will run in to less trouble if your image is smaller.
Prompt the user if they want to encode or decode a message.
Prompt the user for an input file.
If encode, prompt the user for an input message. Encode the message into the picture (details below), then prompt the user for an output file name, and save the new picture/message in this file (using bmp format).
If decode, extract the message from the file and display the message.
Hand in electronically your Steganography main program containing necessary methods and pictures (bitmap).
You have three options for how to encode/decode a message. You must implement two of these options. You can start with the easiest (A) and then add to it to create (B) and then (C).
A. Standard method.
B. Key method.
C. Key + bit method.
A. Standard method.
You will extract all the pixels from the image in one big array. You will be changing the red value for every 10th pixel starting with pixel at array index 0. At this first location (array index 0), change the red value to be the count of the number of characters in your secret message. Note this limits your secret message to a maximum length of 255 characters. Then every 10th pixel after (array index 10, 20, 30, ...) change the red value to reflect the character number in your secret message.
For example, suppose your secret message is ”secret”. This has 6 characters so you would set the red value of the pixel at index 0 as 6. Then ”s” has a unicode character number of 115. So you would then set the red value of the pixel at index 10 as 115. Next ”e” has a unicode character number of 101, so you would set the red value of the pixel at index 20 as 101. And so on for the rest of the message.
B. Key method.
Implement the standard method as described above. Then also add the following key protection features.
If someone knew how our algorithm worked, it would be easy for them to extract secret messages from the image files. We can improve our security by using a ”key”. In this case, a key will be a word or phrase. You can combine the key with the message to produce a scrambled message that is not legible. Only by using the key can you unscramble the message to retrieve the original message.
Here is how we will implement the key feature. The secret message is one string while the key is a second string (usually a shorter string). We will pair up the characters in each string by their positions. Because the key is usually shorter, we will have to reuse the key starting back at the beginning. For example, suppose the secret message is ”a secret” while the key is ”key”. The matching will be as follows (notice the blank space is a character):
a s e c r e t
k e y k e y k e
Now that we have the characters matched up, we will need to perform an xor operation on each pair to create a new output character. You can test your xor operation by writing a small program first or by typing commands at the Dr. Java interactions pane. From the secret/key example, we obtain a resulting output string with mostly non-printable characters (there is an ”E” in the second position).
To unscramble the message, simply repeat the xor operation using the same key. Performing the xor operation twice undoes the scrambling and you will be left with your original message. Now you will have to communicate the key to your friend when you give them the image; be sure to keep the key secret (like a password) because people will be able to read your secret messages once they have the key.
C. Key + bit method.
Implement the key method as described above. Then also add the following bit manipulation features.
The problem with changing the red values in our encode/decode steps, is that these often cause quite visible changes in the resulting image. This is especially true if the pixels that are being changed are part of a large section of uniformly colored pixels – the ”dots” stand out and are noticeable. As an option, we can change only the lower order bits of each pixel color (red, blue, and green). This will make subtle changes to each pixel’s color and will not be as evident.
Remember that each pixel has three bytes: one byte for red, blue and green colors. Each byte has 8 bits to encode a number between 0 and 255. When we swap out the red color byte for a character, it is possible that we are changing the redness of that pixel by quite a bit. For example, we might have had a pixel with values of (225, 100, 100) which has lots of red, some green and some blue – this is basically a reddish pixel with a slight bit of pink color to it. Now suppose we are to store the character ”a” in the red part of this pixel. An ”a” is encoded as decimal number 97 so our new pixel becomes (97, 100, 100). Now we have equal parts of all three colors to produce a dark grey pixel. This dark grey is noticeably different than the dark pink we had before; it will definitely stand out in the image especially if the other nearby pixels are all dark pink.
We want a way to encode our message without making such drastic changes to the colors in the original image. If we only change the lowest bits of each pixel, then the numeric values can only change by a small percentage. For example, suppose we only change the last three bits (lowest three bits) – these are the bits that determine the ”one's place”, the ”two's place” and the ”four's place”. We can only alter the original pixel color value by ±7. Let us think of our original pixel as a bits:
(r7 r6 r5 r4 r3 r2 r1 r0, g7 g6 g5 g4 g3 g2 g1 g0, b7 b6 b5 b4 b3 b2 b1 b0).
And our character (byte) as some bits:
c7 c6 c5 c4 c3 c2 c1 c0
Then we can place three of these character bits in the lowest red pixel, three more in the lowest green pixel, and the last two in the lowest blue pixel as follows:
(r7 r6 r5 r4 r3 c7 c6 c5, g7 g6 g5 g4 g3 c4 c3 c2, b7 b6 b5 b4 b3 b2 c1 c0).
If we had done this to the example of pixel (225, 100, 100) with character ”a”, we obtain:
original pixel = ( 11100001, 01100100, 01100100 )
”a” = 01100001
new pixel = ( 11100011, 01100000, 01100101 )
new pixel = ( 227, 96, 101 )
Notice the new pixel of (227, 96, 101) is almost the same value as the old pixel of (225, 100, 100). There will be no noticeable color difference in the image! To retrieve the message, you simply extract the appropriate pixels from the rgb values to reconstruct the secret character.
To accomplish this, you might want to use the ”logical and” and ”logical or” operators and also the ”shifting” operator.
Thanks in advance