Professional Documents
Culture Documents
Chapter 4
IMAGE STEGANOGRAPHY-
ROTATOCRYPT
63
CHAPTER 4
JPEG images.
reason for choosing JPEG as the image file format supported by this
users, because it takes up much less space than other formats for the
same image. Hence we can find several images in the World Wide Web
the output image with the compressed files hidden in it, using
following steps:
used rarely, the main reason being the use of different programming
standard, JFIF is a basic file format which permits JPEG bit flows to
[98, 100]:
iv) DCT
v) Quantization
4.1.2 Downsampling
chroma subsampling.
4.1.4 DCT
4.1.5 Quantization
first of this block is titled the DC coefficient and the remaining are
remaining.
The decoding process to display the image back from a JPEG file
consists of doing all the above in reverse. As said earlier, only the
quantization matrix
decode and add the data to the image. It uses only the last stage, i.e.,
either embeds data into those blocks or extracts data from those
blocks, and writes the modified block back using entropy coding.
4.2 ROTATOCRYPT
name says, encrypts or decrypts the data bytes only using rotations.
The rotations strictly depend on the password given. Hence, the data
following stages:
1) Password analysis
2) Encryption / Decryption
the password are taken. Though ASCII codes are 7-bits wide,
ii) Next, the 8-bit representations of each of the ASCII codes are
taken.
string.
iv) The long bit string is now divided into bit strings of each of
the long bit string does not span 3 bits, no additional bits are
“PassStore”.
reversed.
The main reason for dividing the entire long bit string into bit
the values guide in rotating the bits of the bytes. A byte consists of 8
times.
71
rotate successive bytes in a data stream. When all the three-bit values
are taken, the next value is taken again from the beginning of
PassStore list to right rotate the next byte. Thus, each byte is right
shifted the three-bit value of times. This transforms the entire data
a correct password.
bytes in the encrypted data stream. When all the three-bit values are
taken, the next value is taken again from the beginning of PassStore
list to left rotate next encrypted byte. Thus, each encrypted byte is left
rotated the three-bit value number of times. This transforms the entire
encrypted data bytes into the original data back, provided the
encrypted data gets decrypted to correct form only when the order of
the three-bit values matches with that of used during encryption. The
provided.
72
of the entire process which hides the data files inside the JPEG image,
in a way that the output JPEG image doesn’t significantly get affected
technique uses the last stage of JPEG encoding (which is same as the
data to be hidden. The process of hiding the data bytes into a JPEG
data.
bytes are collected one after another and grouped as 8-bit values. If the
last set of bit string does not contain 8-bits no padding is done. Then,
the sum of all such 8-bit values is calculated. Finally, the first 8-bits
beginning from the LSB towards the Most Significant Bit (MSB) of the
size plus one (the size of CheckVal being 1 byte) is inserted into the
array at the beginning of the array. It spans first four bytes of the
array. The CheckVal byte is added at the ending of the array. Thus, the
entire message to be hidden now contains the actual length of the data
to be hidden as the first four bytes followed by the actual data bytes
algorithm described above, using the values from PassStore. Thus, the
74
actual data to be hidden, along with the actual length of data and the
CheckVal is encrypted.
hidden are written to image. Otherwise, more data bytes are yet to be
written to the image. Initially, this flag bit is set to false. The Bitcode
values and the category values that are used in entropy coding stage of
At this stage, the given source image is checked for its validity by
marker, then it is also copied to the output image file and the
processing continues.
Frame (SOF) marker is found in the source image data, all the markers
v) Comment (COM)
process only JPEG images, which are usually found in the Internet, a
found, then the processing of the frame segment in the cover image
To process the frame segment, all the frame headers from the
source image are read and decoded and the information is stored in
the suitable data structure. The data gathered from the headers are
about the cover image, such as the width and height of the image, the
(Repeated)
them to the resulting image. The markers that may be encountered are
Now, the scan headers are read and decoded from the source
decode each bit of information, etc. These are also inserted into
data
the JPEG standard, from the compressed scan data. This is the stage
image. All the AC coefficients are processed and embedded with the
defined in the JPEG standard. The LSB of the Huffman code of the AC
coefficient is found. All the coefficients in the equal type occupy the
77
modified so that it stays in the same category as its original. When the
LSB of the Huffman code of the AC coefficient and the secret message
bit are 0 or 1, i.e., both are equal, then no change is needed. Changes
are done only when they are not equal. If the next information bit is 1
Else if the next information bit is 0 and LSB of the code bit is 1, then
JPEG standard and the compressed data are written to the output
image file. Though this compressed data are not the same as the
original, the size of the data is not modified and since the AC
coefficients always stay in the same category, the change in the quality
The steps 4.3.9 and 4.3.10 are repeated until all the data to be
embedded are written into the image or end of the image is reached.
Last, if all the information bits are successfully hidden in the blocks,
78
DataEnded flag is set to true indicating success and this completes the
The first 6 steps noted above are same as the steps discussed
previously under hiding the data into the image, with an exception that
continues with the 7th step, “Decoding and extracting the length of the
hidden data”.
bytes in the cover image, the first 4 bytes in the byte array hold the
79
length of the entire message byte array plus one (CheckVal’s size being
x 8 block is decoded from the compressed scan data in the image file.
coefficients. But, these are in encrypted form. So, they are decrypted
the message bytes are scanned from them. The bytes are read in the
previously. Since, already, the first four bytes, holding the length of the
message, are decrypted, they are removed from the byte array and only
After the data bytes are decrypted, the final byte is the CheckVal
of the leftover message bytes. So, the final byte is removed and a new
as was done while embedding the message in the cover image. If the
produced CheckVal and the CheckVal that earlier existed as the last
byte are equal, then the message decrypted is correct and hence the
password is correct only if two values are matched. Then, the entire
correct.
shots of the program at various points in its progress. This is the main
experiment are shown in Fig. 4.12. Fig. 4.13 shows the resulting stego
images and the resulting MSE, PSNR and Correlation values have been
Result:
Source Files:
Password: BALAJI
image with stego image. The most well known used measures are
PSNR and MSE. The PSNR and MSE values for StegnPEG application
are estimated and are given below. Histograms for various stego
MSE:
The MSE between stego image and cover image is given by Eq.
the quadratic loss or squared error loss. The average of the squares of
estimated.
PSNR:
The PSNR between cover image and stego image is given by Eq.
(1.3). A higher PSNR signifies that the quality of the stego image is
similar to the cover image. The images in Fig. 4.12 are very similar to
(a) (b)
(c) (d)
(e) (f)
89
(g) (h)
Fig. 4.12: Eight cover images
(a) Cover_Leena.jpg (b) Cover_Peppers.jpg
(c) Cover_Baboon.jpg (d) Cover_Barbara.jpg
(e) Cover_Zelda.jpg (f) Cover_Aeroplane.jpg
(g) Cover_Couple.jpg (h) Cover_House.jpg
(a) (b)
90
(c) (d)
(e) (f)
(g) (h)
Fig. 4.13: Eight Stego images
Histogram
“Stego_Baboon.jpg”.
92
4.5 ADVANTAGES
being hidden into the image, the steganalysis becomes very difficult. It
depend on the password. This application also takes care to see that
the quality and size of the output JPEG image is almost identical to
that of the original JPEG image. Since the data to be hidden could be
byte array, into a single JPEG image, thus treating the image as a
place holder for files. Since this application compresses the data before
4.6 CONCLUSIONS
JPEG is the widely used image file format across the Internet
and in digital cameras. At present the JPEG format has been widely
used to send secret data also. Experimental results exhibit that our
size of the image while maintaining high security and good image
multiple files at a time without changing the image quality. Hence, the