Steganography, Compsci 100, Spring 2010

You should snarf assignment stego from http://www.cs.duke.edu/courses/spring10/cps100/snarf or browse the code directory for code files provided. See the Stenagraphy howto file for help and more instructions.

The code provided in this assignment uses the Picture class provided as part of An Introduction to Programming with Java (an Interdisciplinary Approach) by Kevin Wayne and Robert Sedgewick.

A steganography assignment appears in the Nifty Assignments Archive from 2009, that idea gave birth to this assignment, though this one is substantially different. The nifty assignment was originally developed by Tom Murtaugh and Brent Heeringa from Williams College.

Genesis of Assignment

picasso 3 women picasso hidden

These images used by permission of The Hermitage Museum from their Image Usage Policy.

The images to the left are of the 1908 Picasso painting Three Women which is held at the Hermitage Museum in St Petersburg, Russia. One of the images (perhaps both) has a hidden watermark so that the use of the image can be tracked by the Hermitage. Watermarks are a form of steganography where the hidden information is related to the object in which the information is hidden. The other image has been altered by a program equivalent to the one you'll write as part of this assignment to store another, hidden image. Clicking on this link will reveal the hidden image extracted from the Three Women image. The extracted hidden image is a lower-quality version of the original image that was hidden, because it's not possible to hide the complete, full quality image without essentially erasing the Three Women image. (In this case the hidden image isn't of a very high quality to begin with.)

Steganography (see the Wikipedia entry for details) deals with hiding information, typically so that even the existence of the hidden information is hidden. An encrypted message might attract attention --- even if it's not possible to decrypt it, some people will try. But a message whose existence is hidden is hard to decipher because ... well hopefully you get the picture.

You'll also write a program to hide text in an image. This version of Three Women has the complete text of Melville's Bartleby, the Scrivener (a story of Wall-street) hidden in it. Your programs will be able to hide and extract text in an image.

There are several websites that hide text in an image --- exactly what one of the programs you write will do. Of course these sites will extract the hidden text as well, just as your suite of programs will. Site for hiding text in an image include imagecipher, mozaiq/encrypt, and utilitymill.com are the sites.

What You Will Do

You will write five classes for this assignment. Most of them consist of simple changes to the class HideImage which you'll write first and for which you're given code with which you'll start. Each of the classes you write will also have a main method to run it. Hiding and extracting images is required, extra credit can be earned by hiding and extracting text. credit.

Grading

You'll have algorithm/correctness and engineering points for this assignment. Analysis points will be given for the benchmark code and explanation, though that's only done if you're doing the extra part of this assignment.

Each program you write should be robust in the sense that if the inputs don't work, your program should exit gracefully. For example, when hiding a source image in a target, the images must be the same size --- you're given two directories of images that are the same size. This makes things simpler for you as the programmer, so if the images are not the same size, your program should exit gracefully with a message to the user, not crash. When hiding text, you may have more text than can fit in an image. If this is the case, your program should certainly not crash. Ideally you'd inform the user that not all the text was hidden when there's not enough space.

Your analysis file should list your testing results; your README should provide all the people with whom you collaborated, and the TAs/UTAs you consulted with. You should include an estimate of how long you spent on the program and what your thoughts are about the assignment.

Submit your analysis, README, and all of your source code using Eclipse with assignment name stego.

More Extra Credit

For even more extra credit you should write HideText and ExtracText to allow the user the choice of hiding the text in row-major order as described in the howto or in column-major order. Essentially your code will process the pixels in the target image either row-by-row starting with the top row of pixels (this is row-major) or column-by-column starting with the left most column (this is column major). You should give the user the choice of which order to use by appropriate use of the JOptionPane.showOptionDialog method, e.g., as shown below. int opt = JOptionPane.showOptionDialog(null, "Choose Row or Column", "Hiding Text Options", JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE, null, new String[]{"row", "column"}, "row");

You should ask the user for which order to use when extracting and when hiding. You should also try both row- and column-major orders when writing your StegoBenchmark program. Be sure to document in your analysis that you tried the extra credit and how much of it you did.