Steganography, Compsci 100, Fall 2010

http://www.cs.duke.edu/courses/fall10/cps100/snarf

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

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

main

HideImage prompts the user for two images and a number of bits and hides one image (the source) in the other (the target) using the specified number of bits. A starter version of this class HideImage.java is provided that prompts the user for two image files and the number of bits. For this class you only complete part of the method hide that alters one pixel. More details are in the howto.

prompts the user for two images and a number of bits and hides one image (the source) in the other (the target) using the specified number of bits. A starter version of this class HideImage.java is provided that prompts the user for two image files and the number of bits. For this class you only complete part of the method that alters one pixel. More details are in the howto. ExtractImage extracts an image from an image when the user specifies the number of bits to use in the extraction. A starter version of this class ExtractImage.java is provided that prompts the user for the image file and the number of bits. More details are in the howto. The text processing classes and benchmarking code are A credit/extra credit.

extracts an image from an image when the user specifies the number of bits to use in the extraction. A starter version of this class ExtractImage.java is provided that prompts the user for the image file and the number of bits. More details are in the howto. HideText is similar to HideImage but hides text in an image using either one or two bits. The user specifies whether one or two bits will be used as well as both the image file and the file of text to be hidden. More details are in the howto.

is similar to but hides text in an image using either one or two bits. The user specifies whether one or two bits will be used as well as both the image file and the file of text to be hidden. More details are in the howto. ExtractText extracts text hidden in an image specified by the user. The user also specifies whether one or two bits will be used in extracting text --- see the howto for details.

extracts text hidden in an image specified by the user. The user also specifies whether one or two bits will be used in extracting text --- see the howto for details. StegoBenchmark processes every image file in a directory chosen by the user and determines which of the image files contains hidden text as created by the HideText program. You'll need to use method(s) from ExtractText that you write and try both one- and two-bit encodings. You'll need to write a method to determine if a string represents text, ideas can be found in the howto. A starter file StegoBenchmark.java is provided that processes all files in a directory chosen by the user.

Grading

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

HideText

ExtractText

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");