Download - Image Steganography - usna.edu
Image Steganography A Closer Look at the Least Significant Bits Method
27 April 2015
United States Naval Academy
Natasha Monet Patterson and Samantha Frances Lee
1
Introduction & History
The word steganography literally means “covered writing”. It is a combination of the
Ancient Greek words “steganos” and “graphein” meaning covered, concealed, or protected and
“writing” respectively (“Steganography”). Steganography is the “art or practice of concealing a
file, message, image, or video within another file, message, image, or video” (“Steganography”).
The first written source of the term was used in Johannes Trithemius’ trilogy Polygraphia and in
Stegonagraphia (Fridrich, 3).
Although steganography is a broad form of cryptography, steganography and
cryptography differ in their goals. According to a paper written by Gary Kessler, an Associate
Professor and program director of the Computer Networking major at Champlain College in
Burlington, Vermont, “The goal of cryptography is to make data unreadable by a third party, the
goal of steganography is to hide the data from a third party” (Kessler). Another article from the
International Journal of Computer Applications asserts that “…cryptography is about concealing
the content of the message. At the same time an encrypted data package is itself evidence of the
existence of valuable information. Steganography goes a step further and makes the cipher text
invisible for unauthorized users” (S. Kumar, Singh, T. Kumar, and Singh Nehra). In a book
written by Dr. Jessica Fridrich, a professor of Electrical and Computer Engineering at
Binghamton University, State University of New York, says, “The most important requirement
of any steganographic system is that it should be impossible for an eavesdropper to distinguish
between ordinary objects and objects that contain secret data” (xv). Essentially, the difference is
that typically in a cryptographic system the third party is aware that data is being encrypted and
in most sophisticated systems, the method of encryption is publically known or distributed
2
through public channels. However, in a steganographic system part of the secrecy lies in the fact
that it should be virtually impossible to detect the hidden data by looking at an object.
While steganography has been adapted in many forms in modern times to accommodate
the digital age, it has a vast historical background of uses worldwide. The first recorded use of
steganography is 440 BC referenced by Herodotus in his writings The Histories, which serves as
a record of ancient Greek society, the rise of the Persian society, and recounts many of the wars
and conflicts between Persia and the ancient Greek city-states. In his Ancient Greek text, he
alludes to the fact that hidden text was written on wooden writing tablets covered in wax. For
example, “…when Demeratus wanted to notify Sparta that the king of Persia, Xerxes, intended
to invade Greece, he wrote this message on a tablet and covered it with wax to make it appear to
be a blank writing tablet. To recover the message the other people in Sparta simply had to scrape
the wax off the tablet” (“Hiding”).
Another recorded account of steganography by the Ancient Greeks is also conveyed
through Herodotus’ writings. In this particular instance, steganography was used in the form of a
bodily tattoo. Herodotus tells an account of a tyrant of Miletus, Histiaeus, who shaved the head
of one of his slaves, tattooed a message on the slave’s head, and then waited for his hair to grow
back. The slave was then sent to Aristagoras, the regent of Miletus, who was instructed to shave
the slave's head again and read the message. The message intended to encourage Aristagoras to
start a revolt against the Persian king (“Image”).
Aeneas the Tactician made several strides and discoveries in steganography as well. He
hid messages in women’s earrings and described ways to hide messages in text. Some examples
of the methods he described are the modification of the height of letter strokes within text and
marking letters in text using small holes (Fridrich, 3).
3
Other forms of steganography were furthered and developed well after the ancient
Greeks. Pliny the Elder (23-79 AD) recorded one of the earliest methods of invisible ink through
his research of the thithymallus plant which dried transparent to paper, but was dark brown when
heated (“Image”).
In more recent history, there were several accounts of steganography based ideas for
hiding and relaying messages utilized during WWII. The Nazis developed a form of
steganography called microdots. According to an article written by the International Journal of
Engineering and Innovative Technology (IJEIT), “Microdots are microfilm chips created at high
magnification (usually over 200X). These microfilm chips are the size of periods on a standard
typewriter. These dots could contain pages of information, drawings, etc” (Borse, Anand, and
Patel). The Nazis also used invisible inks and null ciphers. A null cipher is a form of
steganography in which case the message, or plaintext, is mixed with a bunch of random non-
cipher messages. During the same war, the United States Marines engaged in using the famous
Navajo “code talkers.” The Navajo code talkers used their native language as a basis of a cipher
to encrypt and send messages.
Moving Forward in Time
The electronic world has advanced rapidly in the most recent decades. We have access
to faster and more reliable digital multimedia, computer software, network trafficking schemes,
and file systems. With these public sources at our fingertips, there comes a need to make our
information private. Through modern steganography practices this goal can be achieved. The
focus of this paper is image steganography. Steganography has evolved in parallel with
advancements in technology and the digital age. As such, many new techniques have been
developed and created to facilitate the hidden transmission of messages and data across various
4
mediums. According to the International Journal of Engineering and Innovative Technology
(IJEIT), “The current digital Steganography includes various text files, still images, moving
images, sound etc. Today all the available digital files can be used for the purpose of hiding
message in steganography” (Borse, Anand, and Patel). The IJEIT highlights the four main
categories of steganography which are via text, image, video, and audio (S. Kumar, Singh, T.
Kumar, and Singh Nehra).
Image Steganography
One of the most popular forms of steganography today is image steganography. Image
steganography is essentially hiding the message within the cover of an image which is also
known as embedding. According to the article written by IJEIT, image steganography is the most
popular due to “…the large amount of redundant bits present in the digital representation of an
image…” (Borse, Anand, and Patel). The International Journal of Computer Applications goes a
step further to describe image steganography as a “…quite simple and secure way to transfer the
information over the communication network on the internet” (S. Kumar, Singh, T. Kumar, and
Singh Nehra).
Terminology
In order to understand the process by which information is hidden within an image,
steganalysis, one must understand the various terms used to describe the different components.
Different sources use various terminologies to refer to the same components and these are the
most commonly used. The first component is called the message. Similar to cryptography, a
message is the information the sender intends for the receiver to read or see. In the case of image
steganography, the message can be encrypted using one of the various methods of encryption in
cryptography, the message can be in plaintext form which means a string of letters or numbers
5
that is not encrypted, or another image (Godara, Sunila, Ranolia, and Megha). If the message is
encrypted, the encryption of that information is called the stego-key. The second component is
the carrier/cover image. The cover image is the image that is used to hide the information
contained in the message. Finally, the stego-image is the combination of the cover/carrier image
and the message. In the case where the message is another image, the stego-image is a picture
within a picture. There are two algorithms associated with each stegonagraphic system as well,
the embedding and extraction algorithms. The embedding algorithm has three inputs: the
message, the secret key (stego-key), and the cover image. The output of this algorithm is what is
referred to earlier as the stego-image. The extraction algorithm has an input of a stego-key and
the output produces the hidden message (Fridrich, 8). The basic process outline starts with a
message the user wants to encode and send to the receiver. This message will be given a cover
image which will hide the message via the Stegosystem Encoder. Along with the hidden
message, there will be a key generated that properly decodes the image when it reaches the
receiver. Once the hidden message is created, it is sent through the traffic channels until it
reaches its destination. The receiver then uses the key provided to decode the photo and read the
original message. (Marvel, 8) The data being embedded must lie within the media. If the
encoding is in a header it may be altered or lost across different data file formats (Bender, Gruhl,
Morimoto, Lu, 314).
LSB
One method, which is also the most common, for inserting messages/information into an
image file is the Least Significant Bit (LSB) Method. This method has its origins dating back to
the 17th century when publishers of logarithmic tables used to introduce errors intentionally in
the least significant digits (“Hiding”). In the LSB insertion method, the binary representation of
6
hidden information is used to overwrite the least significant bits in the cover image (S. Kumar,
Singh, T. Kumar, and Singh Nehra). In steganography, as mentioned before, the ultimate goal is
to ensure that the message is “invisible” to the third party who is trying to intercept it. The LSB
Method exploits this idea. In this method, the data/information that is hidden is inserted into
the least significant bits of the pixel information. According to an article on Academia, “an
increase or decrease of value by changing the least significant bit does not change the appearance
of the image, such that the resulted stego-image looks exactly same as the cover image” (Nain).
When using the LSB Method the insertion of a message, the message is nearly undetectable to
the naked eye.
From the reading Image Steganography for Hidden Communication, Lisa M. Marvel
explains an existing method used to encode messages today that involves the manipulation of
least significant bit (LSB) plane of data. There are various LSB schemes, but most achieve low
perceptibility, high payloads, and removable resistance. These terms mean users are most
interested in how invisible it is that the cover image has been manipulated, how large the
capacity of the encoding method’s data hiding scheme is , or the amount of secret data that can
be hidden in the image, and how difficult it is to decode the image once the coding method is
known. “There are tradeoffs between the quantity of data and the immunity to modification.”
(Bender, Gruhl, Morimoto, Lu, 314) “The LSB method embeds fixed length secret bits into the
least significant bits of pixels by directly replacing the LSBs of cover image with the secret
message bits” (Rossi).
LSB Key
First, an image to hide in the cover image must be chosen. The image is most difficult to
detect when the hidden message image and cover image have similar color schemes to begin
7
with. We have defined our key space as the area in which we are going to hide the image. The
image can be in the center, off to a side, or even shuffled, meaning we spread the pixels out
across the entire cover photo.
Encryption
In Ankit Gupta and Rahul Garg’s paper, Detecting LSB Steganography in Images, they
explain their process of hiding an image inside a cover photo using LSB steganography. First
the s that will be used need to be decided and the image must be transformed into a matrix. “The
original image is in the form of RGB which is converted into a grey image. The grey image is
resized to a particular size of 256*256. Each image has intensity values for every pixel, and
these intensity values are stored into a text file” (Champakamala, Padmini, and Radhika). Thus
these intensity values form our matrix. Now we can modify these bits with the simple method or
the shuffled method.
In the first method, the user is hiding the connected picture in one part of the cover photo.
Ankit Gupta and Rahul Garg explain in their writing, Detecting LSB Steganography in Images,
that to do this the user must randomly select one pixel in the cover photo and designate that as
the top left corner of our hidden photo. The photo is embedded in the lower bits of the cover
photo.
Another example is the shuffled/scrambled version. This is when the pixels from the
hidden image are scattered throughout the cover image. According to the work done by Gupta
and Garg, the user must start by choosing an M x N size cover image and an m x n size image to
be hidden. We choose a portion of the cover photo, specifically m rows of M and n columns of
N. This new matrix of selected rows and columns, let’s call it a x b, will make up the space in
8
which we hide the image. Scrambling, or shuffling as discussed earlier, in this instance is a
permutation of the rows and columns in which the message image’s pixels are inserted within the
cover image. The key consists of the lists of rows, columns, permutation rows, and permutation
columns. In this instance instead of only 5 keys, there are (𝑁𝑛)(𝑀
𝑚) ∗ 𝑛! ∗ 𝑚! where N = length of
cover image in pixels, n = length of message image in pixels, M = width of cover image in
pixels, and m = width of the message image in pixels. In this instance the larger the cover image,
the larger the key space.
Decryption
The simple embedding process is decrypted by communicating the pixel that signifies the
top left corner, as well as the bits used to hide the image and the matrix size of the hidden image.
This information would act as the decryption key for the simple method.
For the shuffled/scrambled message image, use the chosen a x b matrix as our key for
decrypting. If this matrix is known, it is also known exactly which pixels hold the data from the
hidden photo.
If the decryption key is not given or known, a different approach must be taken to decrypt
the hidden image. In the case of simple mode decryption, Gupta and Garg explain a brute force
attack. The key that needs to be found consists of the upper left corner of the hidden image, or
(x,y), the matrix size of the hidden image, (m,n), and the bits chosen to hide it, k. If it is assumed
the hidden image only used bits 1, 2, 3, or 4, then the number of possible answer for the key can
be significantly decreased. For this brute force attack to work, assume that side by side pixels in
the image to be decrypted are similar. The LSB encryption process hides the most significant
bits of the input image, so there is less of a chance that the least significant bits are the same as
9
the cover image. This makes it easier to find discrepancies in the stego-image because it is
interrupted by LSB’s that are not as similar. Gupta and Garg had 100 percent accuracy on the
images they decrypted using brute force attack and they received no false positives or negatives.
For the shuffled image the accuracy was a little less, at about 80 percent. Below is an example of
the simple method.
Application of M-Sequences
The main weakness of LSB arises when the unauthorized party knows the message is
hidden in the LSB. (Marvel, 10) In the paper, A Digital Watermark, coauthored by R. Van
Schyndel, A. Tirkel, and C. Osborne, we find that m-sequences are commonly used with LSB to
encode an image. An m-sequence is a sequence of numbers that represent the of each pixel in
the hidden photo. M-sequences can be formed in many ways. One example is to have the bits
shift in a sequence that goes {4, 3, 2, 1} repeatedly. This means the first pixel has a of 4, the
next pixel has a of 3, and so on. Another example is using the Fibonacci recursion relation;
however these numbers would have to be mod 8 as the can only be the values 0 through 7. The
spectral distribution an m-sequence creates resembles that of random Gaussian noise. To the
naked eye this may look like a poor quality image:
10
Without noise With Noise
(http://en.wikipedia.org/wiki/Gaussian_noise)
The first method described in A Digital Watermark is embedding an m-sequence on an
LSB image. In the experiment described, they encode a 512 by 512 8-bit gray scale image on a
line by line basis with m-sequences that are 2^9 pixels long. The 8-bit gray scale image is
compressed to 7 bits by adaptive histogram manipulation. To restore the dynamic range, the
process is followed by compensating mapping. The final image is indistinguishable from the
original. This allows the watermark information to be carried by the LSB (Van Schyndel, Tirkel,
Osborne, 85-86). A counterpart can be used to decode the image.
The second process described in A Digital Watermark makes use of the auto correction
function of m-sequences. This time LSB addition is used to embed the watermark. The
11
disadvantage of this process is that it must be completed offline; however, it is more secure by
this standard as an unauthorized party would have to perform the same operations as the coder
without any information to go off of. The process is an examination of the complete bit pattern
and its current implementation. One way to decipher this would be to use the image cross
correlation histogram to see the message peaks. The histograms below show the raw image,
without a , versus the image that has been encoded.
In Raymond B. Wolfgang and Edward J. Delp’s paper, A Watermark for Digital Images,
they explain some of the advantages of the addition of m-sequences. The receiver can extract the
exact image sent if they know the sequence of numbers used for the . This means the image will
not be permanently altered during the encoding process. Unauthorized parties could only
decode the image if they knew the private embedded sequence, as the correlation properties
would be altered if pixels with different m-sequences were swapped (Wolfgang , Delp, 219). In
A Watermark for Digital Images, the authors’ specific explanation of watermarks, they explain
how multiple watermarks can overlap each other in one image. This can tell the decoder the
order of users who had the image and this can also further protect the original message by
requiring multiple sequences to decipher each encoded part of the image. Wolfgang and Delp
also point out the disadvantages of the m-sequence and LSB method. The attacker has the
chance of correctly guessing if a given pixel has increased or decreased by a certain shift. If the
12
attacker manages to compute 2n consecutive bits then the attacker can compute the entire
sequence.
LSB Code Broken Down
One of the main focuses of this paper is the LSB Method and its applications. As stated
before, the introduction of an encrypted message, which alludes to the use of a “key” makes the
algorithm more secure. One simple example of a key, as mentioned before, is the position of the
hidden image. For instance, the picture can be positioned in the center, the top left corner, the
bottom left corner, the top right corner, or the bottom right corner. Below is the MATLAB
example that was adopted from Professor Nakos and Professor Margulies which represents the
key where the picture is centered.
Code (Enciphered):
The first step of the code is to introduce the message and cover files. In
this particular instance, the message and cover are both images. As such they are in .jpg format. The variables “message” and “cover_image” are the message
and the cover image respectively. The “imread” command “is used to get the
pixel values of an image into the MATLAB workspace” (Van Loan and Daisy Fan,
315).
message = imread('messageimagefilename.jpg'); cover_image = imread('coverimagefilename.jpg');
In the step below we are creating MATLAB displays for the images. This is
just to see a graphic representation of the images that are being used as
they undergo changes throughout the code and ultimately to keep track of how
the images change after certain components of the code are applied. The axis
command tells MATLAB a particular way of displaying the image which allows
for equal spacing along the axis within the figure.
figure(1), imshow(message); axis equal; title('Original Message'); figure(2), imshow(cover_image); axis equal; title('Cover Image');
In the next steps the image has to be copied into a blank image that is the
same size of the cover image. The purpose of this is so that both the cover
image and the message image have the same dimensions and the number of pixels
is the same.
In a real world application, if a cover image was already posted on a website
and someone intended to hide a message within the picture, he/she could not
simply alter the size of the cover photo. The change would be detectable that
13
the original image was changed and ultimately give away the fact that the
image was altered.
In this example it cannot be assumed that the message image is the same size
as the cover image. So the message image must be resized so that the number
of pixels in the cover image and the message image are equal.
In this example, the message size is 400x314 and the cover image is 1024x677. In order to resize the image, the “uint8” command is used first.
The “uint8” command is a “way of representing numbers where a pixel value is
an integer between 0 and 255” (Van Loan and Daisy Fan, 315). The variable “resized_message” creates a matrix the size of the cover image
which is 1024x677. Each entry in the matrix is the number 255, where 255 on
the RGB scale represents the color white and 0 on the RGB scale would
represent black in terms of images.
In the next line, the dimensions of the message image are used to insert into
the all-white image that is the size of the cover image. The message image is
400x314 and it must be centered, per the key that was chosen. So, since the
dimensions of the cover image are known to be 1024x677, divide each of the
dimensions by 2.
1024/2 = 512 and 677/2 = 338.5
From there, the size of the message image must be divided by 2 as well to
center its dimensions on the center of the cover image.
400/2 = 200 and 314/2 = 157
The first set of entries in the matrix corresponds to the length and the
second corresponds to the width of the picture.
So, the parts of the matrix are used to insert the message in the white image
with respect to the length is from 182-495, which is 314 pixels of data which
is the length of the message image. This range is determined by subtracting
157 from 339 and adding 157 to 339 (where 339 is the center of the cover
image and 157 is the middle of the message image).
Similarly, the same process is done for the width of the picture. The center
of the cover image is 512 and by subtracting and adding 200 to 512, the range
312:711 is determined which is the size of the message image in terms of
width.
In the code, set those pixels to be the message that is intended to be hidden
and name the new picture with the message centered in it “message_new”. The
variable “message_new” is the size of the cover image with the message image
centered in the middle and surrounding white space.
resized_message = uint8(255*ones(size(cover_image))); resized_message(182:495, 312:711, :) = message; message_new = resized_message;
In the next segment of the code, the image is embedded in the cover image so
it can be hidden.
14
The next few steps demonstrate that even though bits are being extracted, it
does not change the image much. So the integrity of the original image is not
changed. This shows why the LSB method works because it capitalizes on the
idea that the least significant bits of an image do not contribute as much to
the overall appearance of the image.
In this particular example, the variable “imbed” is the number of bits in
each pixel that will be shifted. The four least significant bits will be
shifted.
imbed = 4;
The command “bitshift” takes an image and shifts the bits in each pixel (8-
imbed) bits to the left. So, in this example the variable
“shifttoleast_message” is a bit shift of the message image –(8-imbed) bits to
the right. This is essentially shifting 4 bits to the right since it is
opposite the normal direction the command shifts the bits and since imbed =
4. The most significant bits are being shifted to the least significant bits
in this instance.
The variable “showpostshift_message” is a bit shift that takes the new image
with the most significant bits in the least significant bits’ positions and
shifts them back to the left. So essentially, these two shifts have gotten
rid of the least significant bits because they are now replaced with zeros.
The next line shows the new image now that the least significant bits are
gone and proves that the image has not changed much since the least
significant bits have been removed. Thus explaining why this method works to
begin with.
shifttoleast_message = bitshift(message, -(8-imbed)); showpostshift_message = bitshift(shifttoleast_message, (8-imbed)); figure(3), imshow(showpostshift_message); axis equal; title('Message
Shifted');
The next few steps of the code resume the process of hiding the message in
the cover image.
The first step is to shift the bits in the cover image so that its least
significant bits can be filled with the message’s most significant bits.
There are two ways to do this: simply zero all of the cover bits from the last bit to the 4th bit or do the two shifts as shown in the message example
above.
Below the two-shift method is used for continuity.
The first variable “shifttoleast_message” is a bit shift of the message image
created above, “message_new”. Remember, “message_new” is the size of the
cover image, the message image is centered, and it is surrounded by white
space. The image “message_new” is being shifted 4 bits to the right for each
of its pixels. So, the variable “shifttoleast_message” is the most
significant bits of the message image in the least significant bits.
In the next step, the variable “cover_shift” is a bit shift of the cover
image. This is done using the two shift process as shown above. So in the
first shift, the 4 most significant bits of the cover image are moved to the
15
4 least significant bits for each pixel. The next shift is shown in the
variable “coverminusleast” which bit shifts the 4 most significant bits from
the 4 least significant bits back to their original position in each pixel.
So now, the cover image has its most significant bits present in each pixel
to preserve the outward integrity/appearance of the cover image. The least
significant bits are all empty.
So in the final step, the stego image is created. The variable “stego_image”
creates the stego image by adding the variables “coverminusleast” and
“shifttoleast_message” where the “coverminusleast” variable is the original
cover image without its original least significant bits and the
“shifttoleast_message” is the most significant bits of the scaled message
image shifted to the least significant bits of each pixel.
The last line below shows the stego image where the image is embedded in the
cover image.
shifttoleast_message = bitshift(message_new, -(8-imbed));
cover_shift = bitshift(cover_image, -(8-imbed)); coverminusleast = bitshift(cover_shift, (8-imbed));
stego_image = coverminusleast + shifttoleast_message; figure(4), imshow(stego_image); title('Stego Image');
Code (Deciphered):
To decrypt this message and recover the original message based on this
algorithm, the user would have to know the number of bits that were shifted
for each pixel, the variable “imbed”. The user would then bit shift the
stego-image back to the left to move the message most significant bits from
the least significant bits position to the most significant bits position.
stego_image = bitshift(stego_image, (8-imbed));
One of the flaws in the code above is that the person decrypting the message will never
be able to return to the original version of the picture. The best approach of encryption has the
ability to recover the original message. One way to go about that process is to simply make the
original message the message without its least significant bits and then resize that image which
leads to the following code and algorithm.
Code to Recover Original Message (Enciphered):
message = imread('messageimagefilename.jpg'); cover_image = imread('coverimagefilename.jpg');
16
figure(1), imshow(message); axis equal; title('Original Message'); figure(2), imshow(cover_image); axis equal; title('Cover Image');
Here the change begins because the number of bits that needs to be shifted is
initialized by the variable “imbed”. The message image is then shifted so
that its most significant bits are in its least significant bits’ position
then the bits are shifted back to their original position.
imbed = 4; shifttoleast_message = bitshift(message, -(8-imbed)); shifttoleast_message = bitshift(shifttoleast_message, (8-imbed));
Below the message is then embedded in a white image the size of the cover
image and the rest of the code follows as before.
resized_message = uint8(255*ones(size(cover_image))); resized_message(182:495, 312:711, :) = shifttoleast_message; message_original = resized_message;
cover_shift = bitshift(cover_image, -(8-imbed)); coverminusleast = bitshift(cover_shift, (8-imbed));
message_original = bitshift(message_original, -(8-imbed));
stego_image = coverminusleast + message_original; figure(3), imshow(stego_image); title('Stego Image');
Code (Deciphered):
To decrypt this message and recover the original message based on this
algorithm, the user would have to know the number of bits that were shifted
for each pixel, the variable “imbed”. The user would then bit shift the
stego-image back to the left to move the message most significant bits from
the least significant bits position to the most significant bits position.
stego_image = bitshift(stego_image, (8-imbed));
Algorithm (Encipher):
1) Upload versions of the message and cover images into the MATLAB domain.
2) Set the number of bits as the variable “imbed” that are considered to be the least
significant bits. When a bit shift is performed, the bit shift will be (8-imbed) or –(8-
imbed) bits to the left or right respectively.
3) Bit shift the message picture that is used to the right so that its most significant bits
become its least significant bits.
17
4) Resize the message so that it becomes the same size as the cover image and center the
message. This is the original message.
5) Bit shift the cover image to the right and then to the left so that its’ least significant bits
are erased.
6) Add the bit shifted cover image and the resized message image together to create the
stego-image.
Algorithm (Decipher):
1) Bit shift the stego-image to the left (8-imbed) bits to recover the original message.
How this Code would change with new keys:
The highlighted portion of code below would change because the key would require all of
the calculations that were used above to center the message image.
resized_message = uint8(255*ones(size(cover_image))); resized_message(182:495, 312:711, :) = shifttoleast_message; message_original = resized_message;
For instance, if the user wanted to place the message image in the top left corner they
would instead write:
scaled_message(1:314, 1:400, :) = message;
Below are the lists of how the codes would change depending on the five keys that were
used in this example:
resized_message(1:314, 1:400, :) = shifttoleast_mesage; (message image top
left corner)
resized_message(1:314, 625:1024, :) = shifttoleast_mesage; (message image top
right corner)
resized_message(364:677, 1:400, :) = shifttoleast_mesage; (message image
bottom left corner)
resized_message(364:677, 625:1024, :) = shifttoleast_mesage; (message image
bottom right corner)
How this Algorithm Would Change with New Keys (Encipher):
18
1) Upload versions of the message and cover imaged into MATLAB domain.
2) Set the number of bits that are considered to be the least significant bits. This is the
variable imbed. When a bit shift is performed the bit shift will be (8-imbed) bits to the
left or right.
3) Bit shift the message picture that is used to the right so that its most significant bits
become its least significant bits.
4) Resize the message so that it becomes the same size as the cover image and relocate the
picture based on where the picture will be located: top right, top left, bottom right, bottom
left, or centered. This is the original message.
5) Bit shift the cover image to the right and then to the left so that its’ least significant bits
are erased.
6) Add the bit shifted cover image and the resized message image together to create the
stego-image.
How to Build Keys:
1) Upload the message image.
2) Resize the message image to that of the size of the cover image. The pixels that are not
the message image should be all white space, or the number 255.
3) The message image can be placed in a top left corner, top right corner, bottom left corner,
bottom right corner, or the center. This is based on the size of the cover image.
4) Find the dimensions of the message image and determine what the picture will be. The
following steps are talking about the matrix that is the size of the cover image and is
originally a complete white image. The goal is to embed the message in the white image
and position it as follows:
19
i) Centered: Determine the size of the cover image. Find the middle of the cover
image both length-wise and width-wise. Using the size of the message image,
determine its half-length and half-width by dividing its dimensions by two. The
dimensions of the message picture should be centered on the dimensions of the
middle of the cover image. So the span of the message pixels length-wise and
width-wise should match the dimensions of the message image.
ii) Top Left Corner: Determine the size of the cover image. Start both the length and
width at the very first matrix table entry for the cover image and ensure that they
span the message image’s dimensions length-wise and width-wise.
iii) Top Right Corner: Determine the size of the cover image. Start the length-wise
dimension at the very first matrix table entry and ensure that it spans the length of
the message image. Ensure that the width entry ends at the width of the cover
image and spans the width of the message image.
iv) Bottom Left Corner: Determine the size of the cover image. Start the width-wise
dimension at the very first matrix table entry and ensure that it spans the length of
the message image. Ensure that the length entry ends at the length of the cover
image and spans the length of the message image.
v) Bottom Right Corner: Determine the size of the cover image. Ensure that both the
width-wise and length-wise dimensions end at the length and width of the cover
image and that the length and width span the length and width of the message
image.
Algorithm where the key is in a different position (Deciphered):
1) Bit shift the stego-image to the left (8-imbed) bits to recover the original message.
20
This key scheme and others would be based on the size of the cover image so it would be
different for each image. However the decryption method using these various keys is the same as
the key that centers the message.
Other Methods
Different methods, besides LSB, exist for hiding messages. In Marvel’s paper, she
describes modifying images of text, such as adjusting the spacing of words and letters to,
changing the dots on an “i” or “j”, and moving subscripts. Encoders can also utilize the
luminance of an image. This can be done by converting the red, green, blue (RGB) scale to a
grayscale. According to Marvel’s work, an encoder can perform LSB replacement by flipping
the grayscale blocks of an image. This path is simple, but it does not require any specialist
software. The embedding is done by changing bits by +1 or -1. The sign is randomly chosen and
the hidden method is not affected (Marvel, slides).
Another domain of image steganography is JPEG compression. “JPEG compression is
the most common image format used for storing and transmitting data on the web.” (JPEG) In
this process “image data is transformed from spatial domain to frequency domain. Only the
quantized frequency coefficients are saved” (Marvel, slide). The Joint Photographic Experts
21
Group, or JPED, uses DCT transform. DCT stands for Discrete Cosine Transform and it is “a
strong energy compaction property” (Marvel, slide). We use DCT for lossy data compression.
“In information technology, “lossy” compression is the class of data encoding methods that uses
approximations for representing the content that has been encoded” (Lossy_compression). This
reduces the total amount of data needed to store or display the desired image. The cat image
displays the degradation of the image as less data is used to display the image.
Even while data is being removed, the quality of the remaining data is unchanged. For the DCT
process we transform an 8 by 8 block of pixels into an 8 by 8 coefficient array. The largest image
size used in JPEG is one with 65535 by 65535 pixels, meaning the process could drastically
decrease the number of components of an image (Hamilton, 3). We begin by taking the DCT
coefficient matrix and dividing it element-wise by the quantization matrix. Typically this matrix
will have higher values in the bottom right to create more zeroes in the resulting matrix. The
image’s orientation is always top down, meaning the first changes will be made in the upper left
corner of the image and gradually work down to the lower right (Hamilton, 3). We round the
quotients to the nearest whole number, which significantly decreases the total amount of data.
22
The data is then formatted in a zig-zag order to output a modified matrix (Code-excited linear
prediction). After the matrix undergoes the entropy encoder, by means of the Huffman table, the
JPEG image travels to the receiver through one of many possible avenues. The Huffman table is
created by “an algorithm that outputs a variable-length code table for encoding a source symbol,
such as a character in a file. Huffman's algorithm derives this table based on the estimated
probability or frequency of occurrence for each possible value of the source symbol”
(Huffman_coding). Finally, the receiver implements the decoding process to reverse what has
been done to the matrix. Again the zig-zag ordering is used to obtain a matrix that can be
modified by the I-quantizer to output I-DCT. This is the final matrix intended for the receiver to
see and understand. The quantization process can never be reversed as the components were
discarded. The entire process has a payload of one hidden bit of data according to Marvel’s
research. From the research done by Thomas Lane, we are told the human eye is better at
noticing a difference in brightness or color when looking over an image compared to its original.
The eye is less capable of picking up on differences of high-frequency brightness variations. It
follows that the lower quality image that is required, the lower the high-frequency components
there are until they are removed altogether.
Conclusion
The security of the image steganography process mainly resides in the fact that the
attacker does not know they are looking at a stego-image. If the message is hidden well enough
in the cover image, then the attacker will not know to check the image. If however, the attacker
does try to decode the image, then they will potentially have to go through the entire key space to
check for the key that decodes the image. The key space depends on image size and possible
places to move or shuffle the hidden photo, but overall it is always a finite key space.
23
Image Steganography is very applicable to this day and age as the internet and social
media are main communication avenues. A well-crafted stego-image could easily pass
thousands of eyes without a second thought before it reached its destination and delivered a
message. If an attacker did choose to decrypt the image, several methods of making the
decryption much harder including the simple method, the shuffled method, and m-sequences
were described in detail. Image Steganography will be present in Cryptology in the years to
come because it is a method that is impossible to break when it is not known that it is there.
24
Works Cited
Borse, Govinda, Vijay Anand, and Kailash Patel. "Steganography: Exploring an Ancient Art of
Hiding Information from Past to the Future." International Journal of Engineering and
Innovative Technology (IJEIT) 3.4 (2013): 192-94. Web. 26 Mar. 2015.
Champakamala, B. S., K. Padmini, and D. K. Radhika. "Least Significant Bit Algorithm for
Image Steganography." International Journal of Advanced Computer Technology (n.d.):
n. pag. Web. 22 Apr. 2015. <http://ijact.org/volume3issue4/IJ0340004.pdf>.
"Code-excited Linear Prediction." Wikipedia. Wikimedia Foundation, n.d. Web. 30 Mar. 2015.
http://en.wikipedia.org/wiki/Code-excited_linear_prediction.
Fridrich, Jessica. Steganography in Digital Media: Principles, Algorithms, and Applications.
Cambridge: Cambridge UP, 2010. Print.
"Gaussian Noise." Wikipedia. Wikimedia Foundation, n.d. Web. 27 Mar. 2015.
http://en.wikipedia.org/wiki/Gaussian_noise.
Godara, Sunila, Ranolia, and Megha. "Image Steganography Techniques: Review." International
Journal of Science, Engineering and Computer Technology 3.1 (2013): 169-72. ProQuest.
Web. 26 Mar. 2015.
Gupta, Ankit, and Rahul Garg. "Detecting LSB Steganography in Images." (n.d.): n. pag. Web.
22 Apr. 2015. <http://rahuldotgarg.appspot.com/data/steg.pdf>.
Hamilton, Eric, C-Cube Microsystems, JPEG File Interchange Format, Version 1.02, September
1,1992-https://web.archive.org/web/20140903080533/http://www.jpeg.org/public/jfif.pdf
"Hiding Information Perfectly - Historical Overview." A Short History of Steganography. Hiding
Information Perfectly, n.d. Web. 26 Mar. 2015.
25
"Huffman Coding." Wikipedia. Wikimedia Foundation, n.d. Web. 28 Mar. 2015.
http://en.wikipedia.org/wiki/Huffman_coding.
"Image Steganography and Steganalysis." Steganography and Steganalysis Outline (n.d.): n. pag.
George Mason University CS Department. Web. 26 Mar. 2015.
"JPEG." Wikipedia. Wikimedia Foundation, n.d. Web. 24 Mar. 2015.
http://en.wikipedia.org/wiki/JPEG.
Kessler, Gary C. "Steganography: Hiding Data Within Data." Steganography. N.p., Sept. 2001.
Web. 26 Mar. 2015.
Kumar, Suresh, Ganesh Singh, Tarun Kumar, and Maninder Singh Nehra. "Hiding the Text
Messages of Variable Size Using Encryption and Decryption Algorithms in Image
Steganography." International Journal of Computer Applications 61.6 (2013): 47-52. Jan.
2013. Web. 26 Mar. 2015.
"Lossy Compression." Wikipedia. Wikimedia Foundation, n.d. Web. 24 Mar. 2015.
http://en.wikipedia.org/wiki/Lossy_compression.
Nain, Ajay. "Implementation of Steganographic Techniques in Matlab: Project Report."
Implementation of Steganographic Techniques in Matlab: Project Report. Academia, n.d.
Web. 26 Mar. 2015.
Rossi, Lorenzo. "Peak-Shaped-Based Steganographic Technique for JPEG Images." EURASIP
Journal on Information Security. N.p., 10 Feb. 2009. Web. 02 Apr. 2015.
http://jis.eurasipjournals.com/content/2009/1/382310/abstract.
R. Van Schyndel, A. Tirkel, and C. Osborne. A digital watermark. Proceedings of the IEEE
International Conference on Image Processing, 2:86{90, 1994.
26
R.B. Wolfgang and E.J. Delp. A watermark for digital images. Proceedings of the IEEE
International Conference on Image Processing, Lausanne, Switzerland, III:219{222,
September 1996.
"Steganography." Wikipedia. Wikimedia Foundation, n.d. Web. 26 Mar. 2015.
Van Loan, Charles F., and K.-Y Daisy Fan. Insight Through Computing: A MATLAB
Introduction to Computational Science and Engineering. Philadelphia, PA: Society for
Industrial and Applied Mathematics, 2010. Print.