Top Banner
ACM 11: Steganography Project This is one possible topic for the ACM11 MATLABproject. Difficulty rating: easy. 100 points. 10/22/08. Steganography is the technique of hiding data, in contrast to cryptography, which is the technique of making it difficult for a 3rd party to recover data. In steganography, the idea is that a 3rd party never notices the data in the first place. With the advent of computers and high-quality image formats (e.g.jpeg), steganographic techniques have been applied to computer images. For a basic overview, please see http://en.wikipedia.org/wiki/Steganography. Original kitten image Original lion image kitten image with hidden data recovery of hidden "lion" data Figure 1: Upper row: original images. Lower row: image with hidden data, and recovery of the hidden data. Upon close inspection, you can see that the lower row images are lower-quality than the upper-row images. Pictures from Wikimedia Commons. Steganography works for images precisely because images are usually compressible. If we perturb the values of pixels a little bit, the human eye probably won’t notice. So, here’s how we can exploit this: suppose each pixel p is stored as 8 bits, representing a number between 0 and 255. For example, if we have a picture of a kitten, for a fixed pixel, let’s call the bits [k 1 ,k 2 ,k 3 ,k 4 ,k 5 ,k 6 ,k 7 ,k 8 ]. The first bit, k 1 , is very important because it represents 128 = 2 7 , while the last bit, k 8 , is less important because it represents 1 = 2 0 . Suppose we make a truncated image where the pixel p is just [k 1 ,k 2 ,k 3 ,k 4 , 0, 0, 0, 0]. Then the difference to the human eye may not be too significant (it depends on whether the image was already compressed a lot). Now, take another image, for example an image of a lion, and suppose its value for the same pixel is [l 1 ,l 2 ,l 3 ,l 4 ,l 5 ,l 6 ,l 7 ,l 8 ]. Again, if we truncate this to [l 1 ,l 2 ,l 3 ,l 4 , 0, 0, 0, 0], 1
2

ACM 11: Steganography Project - Applied Mathematicsamath.colorado.edu/faculty/becker/acm11/projects/steg.pdfACM 11: Steganography Project This is one possible topic for the ACM11 MATLABproject.

Apr 26, 2018

Download

Documents

doankhuong
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: ACM 11: Steganography Project - Applied Mathematicsamath.colorado.edu/faculty/becker/acm11/projects/steg.pdfACM 11: Steganography Project This is one possible topic for the ACM11 MATLABproject.

ACM 11: Steganography Project

This is one possible topic for the ACM11 MATLAB project. Difficulty rating: easy. 100 points.10/22/08.

Steganography is the technique of hiding data, in contrast to cryptography, which is the techniqueof making it difficult for a 3rd party to recover data. In steganography, the idea is that a 3rd partynever notices the data in the first place. With the advent of computers and high-quality imageformats (e.g. jpeg), steganographic techniques have been applied to computer images. For a basicoverview, please see http://en.wikipedia.org/wiki/Steganography.

Original kitten image Original lion image

kitten image with hidden data recovery of hidden "lion" data

Figure 1: Upper row: original images. Lower row: image with hidden data, and recovery of thehidden data. Upon close inspection, you can see that the lower row images are lower-quality thanthe upper-row images. Pictures from Wikimedia Commons.

Steganography works for images precisely because images are usually compressible. If we perturbthe values of pixels a little bit, the human eye probably won’t notice. So, here’s how we can exploitthis: suppose each pixel p is stored as 8 bits, representing a number between 0 and 255. For example,if we have a picture of a kitten, for a fixed pixel, let’s call the bits [k1, k2, k3, k4, k5, k6, k7, k8]. Thefirst bit, k1, is very important because it represents 128 = 27, while the last bit, k8, is less importantbecause it represents 1 = 20.

Suppose we make a truncated image where the pixel p is just [k1, k2, k3, k4, 0, 0, 0, 0]. Thenthe difference to the human eye may not be too significant (it depends on whether the image wasalready compressed a lot). Now, take another image, for example an image of a lion, and suppose itsvalue for the same pixel is [l1, l2, l3, l4, l5, l6, l7, l8]. Again, if we truncate this to [l1, l2, l3, l4, 0, 0, 0, 0],

1

Page 2: ACM 11: Steganography Project - Applied Mathematicsamath.colorado.edu/faculty/becker/acm11/projects/steg.pdfACM 11: Steganography Project This is one possible topic for the ACM11 MATLABproject.

there’s a chance that the quality isn’t reduced too noticeably.From the truncated kitten and lion images, we can form a new image with values [k1, k2, k3, k4, l1, l2, l3, l4].

When viewed, this will look similar to the original kitten image. The lion image is “hidden” in-side the lower-order bits. To recover the lion image, we can manipulate the bits to get back[l1, l2, l3, l4, 0, 0, 0, 0].

For the project, you should recreate Figure 1. Download the kitten and lion images from http://www.acm.caltech.edu/~acm11/2008/FALL/projects/kitten.jpg and http://www.acm.caltech.edu/~acm11/2008/FALL/projects/lion.jpg. In MATLAB , use the imread command to load theimages into a 3-dimensional array; you can also use imfinfo to see information about the files.Note that imread can actually read a file specified by a URL. The elements of the array are allunsigned 8-bit integers. The first two dimensions are spatial dimensions of the picture, and the3rd dimension represents a different color. This is not how jpeg images are stored, but it his howMATLAB converts them, and it is a very convenient form for us to work with.

To work with bits, use the MATLAB command bitshift. This command will operate on alldimensions at once, so it is actually possible to make the new image (with the hidden data) withone or two lines of code and a few calls to bitshift. Make an image of the kitten, but with thelion image hidden in the lower-order bits.

Now, save this new image back as a jpeg file. Use MATLAB’s imwrite command, but be carefulto specify “lossless” mode, otherwise MATLAB will try to compress the image, and the lower-orderbits will be lost (the lossless jpeg format is not widely supported, so if you wish to have an imagethat is easy to view, you may instead save to an inherently lossless format, such as png). We nowhave a hidden image inside a jpeg (or png) file. Read the image back into MATLAB , and recoverthe lion image, using bitshift again. Make a plot like Figure 1, using image to plot the images.You may find commands like axis square and axis off useful for making more aesthetic plots.

Your project should consist of 3 parts: (1) A function, main.m, that produces a plot like Figure1. Preferably, read the images from a URL. (2) A file called hiddenData.jpg (or hiddenData.png)that contains the kitten image, with the lion image hidden in the least-significant bits. (3) Anotherfunction, findLion.m, that reads hiddenData.jpg (or hiddenData.png) and produces an imageof a lion. Put these files in a folder called Firstname Lastname proj steg, where you replaceFirstname and Lastname with your first and last names, respectively, and upload this via ftp.

2