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.
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.
main method to run it. Hiding and extracting images is
required, extra credit can be earned by hiding and extracting text.
credit.
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.
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.
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.
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.
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.
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.
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.
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.