You are on page 1of 41

PRESENTATION

ON

STEGNOGRAPHY TECHNIQUE USING DCT


QUANTIZATION AND MODIFIED FIBONACCI
SERIES DECODER
Submitted By:
Shekhar
Enrolment No.: 07E2ARCSM30P616
Outline
Steganography is the art and science of hiding information within
information. This thesis introduces steganography and focus on the
Discrete Cosine Transform (DCT) technique for hiding messages in an
image. The proposed method modifies the quantization table first.
Next, the secret message is hidden in the cover-image with its middle-
frequency of the quantized DCT coefficients modified, using Modified
Fibonacci Series Decoder (MFSD). Further it enhances the security by
using public key RSA encryption algorithm on message prior to
hiding.

2
INTRODUCTION TO
STEGNOGRAPHY
Introduction to Stegnography
Digital communication is essential part in everyone life. Often it is
desired that communication should be secret Two techniques are
available to accomplish this goal the Cryptography and the
Steganography.

In Cryptography the sender encrypts the message with a key and the
encrypted message is sent to receiver over an insecure communication
channel. On the other side, the receiver decrypts the received
encrypted message with a key and extracts the original message. The
key for sender and receiver can be same or different.

Second method is steganography, where the secret message is hidden


in another message, image, audio or video.. The word steganography is
derived from the Greek words stegos meaning cover and grafia
meaning writing [5] defining it as covered writing.
4
BACKGROUND
INFORMATION
JPEG Standard Compression (colour image)

Huffman
Table

AC

Zig-zag Huffman
reordering coding
Color
88 Quantizer JPEG
components
DCT bit-stream
(Y, Cb, or Cr)

Difference Huffman
DC Encoding coding

Quantizatio
n
Table Huffman
Table

Fig 1. Baseline JPEG encoder 6


Image Transformation from RGB to YCbCr
Colour images are transformed from RGB into luminance /
chrominance colour space. Y component is called luminance and (Cr
and Cb) are called chrominance. The following equations are used to
compute the YCbCr values from RGB.
Y = (77/256) R + (150/256) G + (29/256) B
Cb = - (44/256) R (87/256) G + (131/256) B + 128 (1)
Cr = (131/256) R (110/256) G (21/256) B +128

The following equations are used to compute the RGB values from
YCbCr .
R = Y + 1.371 (Cr 128)
G = Y 0.698 (Cr 128) 0.336 (Cb 128) (2)
B = Y + 1.732 (Cb 128)
These values ranges from -128 to +127 for Y, Cb and Cr, for R, G, B
in range 0 to 255
7
The JPEG Process
The following is an overview of the JPEG process.

1.The image is broken into blocks of 8x8 pixels.

2.Working from left to right, top to bottom, the DCT is applied to each
block.

3.Each block is compressed through quantization.

4.The array of compressed blocks that constitute the image is stored in


a drastically reduced amount of space.

5.When desired, the image is reconstructed through decompression, a


process that uses the Inverse Discrete Cosine Transform (IDCT).

8
The JPEG Process
Image Blocks :The pixels of each colour component are organized in
groups of (8 x 8) pixels (or data units). If the number of image rows
and columns is not a multiple of 8, the bottom row and the rightmost
column are duplicated as many times as necessary
The DCT Equation :The DCT equation given below computes the i,jth
entry of the DCT of an image.
1 N 1 N 1
( 2 x 1)i ( 2 y 1) j
D (i, j ) C (i ) C ( j ) P ( x, y ) cos cos
2N x 0 y 0 2N 2N
(3)
1
C (u ) if u is 0, else 1 if u 0
2
P(x, y) is the x,yth element of the image represented by the matrix P. N
is the size of the block that the DCT is done on. The equation
calculates (i,jth) entry of the transformed image from the pixel values
of the original image matrix. For the standard 8x8 block that JPEG
compression uses, N equals 8 and x and y range from 0 to 7
9
The DCT Matrix
1
Ti , j if i = 0
N

2 (2 j 1)i (4)
Ti , j cos if i > 0
N 2N
For an 8x8 block it results in this matrix:

10
Doing the DCT on an 8x8 Block
Since an image comprises hundreds or even thousands of 8x8 blocks of
pixels, the following description of what happens to one 8x8 block is a
microcosm of the JPEG process; what is done to one block of image
pixels is done to all of them. Because the DCT is designed to work on
pixel values ranging from -128 to 127, the original block is levelled
off by subtracting 128 from each entry to get matrix M.
Now perform the Discrete Cosine Transform, which is accomplished
by matrix multiplication.
D = T M T

In above Equation matrix M is first multiplied on the left by the DCT


matrix T from the previous section; this transforms the rows.The
columns are then transformed by multiplying on the right by the
transpose of the DCT matrix.

11
Quantization
This block matrix now consists of 64 DCT coefficients, Dij, where i
and j range from 0 to7.The top-left coefficient, D00, correlates to the
low frequencies of the original image block. As one moves away from
D00in all directions, the DCT coefficients correlate to higher and
higher frequencies of the image block, where D77 corresponds to the
highest frequency.
Quantization :Quantization is achieved by dividing each element in
the transformed image matrix D by the corresponding element in the
quantization matrix, and then rounding to the nearest integer value. For
the following step, quantization matrix Q50 is used.

Di , j
Ci, j round
Q
i, j
12
Coding
all coefficients of C are converted by an encoder to a stream of binary
data (01101011...). After quantization, it is quite common for most of
the coefficients to equal zero. JPEG takes advantage of this by
encoding quantized coefficients in the zig-zag sequence shown in
Figure below .The advantage lies in the consolidation of relatively
large runs of zeros, which compress very well. The sequence in Figure
2 below (4x4) continues for the entire 8x8 block. The JPEG specifies
two entropy-coding methods: Huffman coding and arithmetic coding .

13
Fig 2. zig-zag sequence
THE PROPOSED
HIDING SYSTEM
The Proposed Hiding System
This stage includes two parts
1. Cryptography
2. Steganography

Cryptography :The cryptography part includes encryption of the


secret message by using public key RSA encryption algorithm.

Steganography :The steganography part includes hiding the


encrypted secret message in JPEG image. This work uses middle
coefficient to hide message using Modified Fibonacci Series
Decoder (MFSD).
This approach provides two level of protection ,first level protection
by using RSA encryption algorithm and second level of protection
by stegnography
15
Modified Fibonacci Series Decoding (MFSD)
This section describes the Modified Fibonacci series decoding
Method, in this approach 3 bits are embedded by altering only
single bit in a DCT quantized coefficients using Encoder/Decoder.
First the DCT quantized coefficients is decomposed using Modified
Fibonacci number representation. The Modified Fibonacci number
is generated using the following formula

Ln = Ln-1 + Ln-2 L1 =2 and L2 =1 (5)

To represent a number in the range [0,255] twelve Modified Fibonacci


number are required.

16
Modified Fibonacci Series Decoding (MFSD)
The DCT quantized coefficients value will be represented as sum of
non consecutive Modified Fibonacci number. For example Binary
and Modified Fibonacci number presentation of value 26 is given
below

Binary representation 00011010


Modified Fibonacci number representation 000001010010

The motivation behind using Modified Fibonacci number is that


Modified Fibonacci bit is less significant than that of traditional
binary bit. For example if the 5th bit is altered to 0 then it becomes
10 in binary representation while 19 in Modified Fibonacci number
representation which is more close to the original value.

17
Modified Fibonacci Series Decoding (MFSD)
Removing ambiguity in conversion of number into modified
Fibonacci number
Every single number can be represented in many different ways using
modified Fibonacci representation. For example the number 22 can be
represented using modified Fibonacci number into 000001000110 or
000000110110
000001000110 as 18+3 +1=22
000000110110 as 11+7 +3+1=22
To remove such ambiguity this thesis makes use of the following
algorithm, by using this algorithm there will be only one representation
in modified Fibonacci number for a given value
Given an array L (Modified Fibonacci array) having following values
L= [199 123 76 47 29 18 11 7 4 3 1 2]

18
Modified Fibonacci Series Decoding (MFSD)
NUM is the input number which has to be Convert into modified
Fibonacci number and SOL is the resultant array which will hold the
modified Fibonacci binary representation and its initial values are
SOL=[0 0 0 0 0 0 0 0 0 0 0 0]; This algorithm will convert
NUM into SOL (Modified Fibonacci representation).the steps are as
follow
Step1 Read the Number NUM for conversion and initialize i with
value 1 i.e. i=1;
Step2 repeat steps 3 to 5 while i<=12
Step 3 SOL[i]=NUM/L[i]
Step 4 NUM=NUM%L[i]
Step 5 Increment value I by one i.e. i=i+1;
Step 6 Display SOL
Step 7 End
Here / is integer division operator and % is modules or remainder
operator 19
Modified Fibonacci Series Decoding (MFSD)
A 7 bit encoder/decoder is proposed for generating stego image. It
takes 7 bits (b7, b6, b5, b4, b3, b2, b1) LSB of DCT quantized
coefficients by using modified Fibonacci representation as inputs
and produces 3 bits of outputs f3, f2, and f1. Figure 3 shows the
encoder/decoder generator.

Figure 3: Encoder/Decoder for stego image generation


20
Modified Fibonacci Series Decoding (MFSD)
For each coefficients the 7 least significant bits are applied to the
encoder/decoder, three Exclusive OR operations create three outputs f3, f2
and f1 f3=b1b5b6b7 (6)
f2=b1b3b4b7 (7)
f1=b1b2b4b6 (8)
Where suppose f3, f2, f1 are the hidden message which is embedded in the
DCT quantized coefficients . If f3, f2, f1 are the same as the hidden
message then there is no need to alter that original DCT quantized
coefficients .
If not, it is needed to change that original DCT quantized coefficients in a
way to cause the output of the encoder/decoder be equal to the hidden
message.
This work allows alternation in only one bit that can be any of the seven
bits to make the outputs of the encoder/decoder is equal to the hidden
message. The procedure that changes only one bit is described in table 1.

21
0
0

1 1 1 1 0 1 1

1
0

For example Let The Seven Bit


1111011 is inputted to this 0
Decoder it will produce 3 Bit
010 as output
TABLE 1 Procedure of changing seven LSB of a DCT coefficients for three bits of message
Here to hide Message 001(3 Bit ) it is
Changes in cover image to
Seven LSB bits of requred
Encoder/ to Change only thedesired message
match
Let
Now 7 LSB 7Bit
letCover
LSBofBit
DCT Cover
of
quantized singleBit(2nd Bit Message
Decoder from LSB) Stego DCT quantized
Let
S.No 7 LSB Bit of Cover
be 0000000
Cover and msg
be 0000000 and
coefficients Output (3 bits) coefficients (7bits)
be 11111111 and msg Here to hide Message 111(3bit)it
to hide
to to
msg be hide is 001 f3 f2 f1
to bebe hide
hide is 111
is 011 is requierd0 0to1changeMFSD
only the
0 0 0 0 0 1 0
single Bit(1 st
0 1 0 Bit from LSB)0 0 0 0 1 0 0
0 1 1 0 0 0 1 0 0 0
0000000 0 0 0 1 0 0 0 0 1 0 0 0 0
1 1 0 1 0 1 0 0 0 0 0
1 1 0 1 0 0 0 0 0 0
1 1 1 MFSD 0 0 0 0 0 0 1
0 0 0 0 0 0 0 0 0 0
0 0 1 1 0 0 0 0 0 1
0 1 0 0 1 0 0 0 0 1
0 0 0 0 0 0 1 Here to
1 hide
1 1 Message 011(3 0 1 Bit
1 ) it is 0 0 1 0 0 0 1
2 requred to Change only 1 0 the
0 0 0 0 1 0 0 1
singleBit(4nd Bit from1 LSB)
0 1 0 0 0 0 1 0 1
1 1 0 0 0 0 0 0 1 1
----- ---------- ------- ------- ---------------
0 0 1 1 1 1 1 1 0 1
0 1 0 1 1 1 1 0 1 1
0 1 1 1 1 1 0 1 1 1
1111111 0 0 0 1 0 0 MFSD 1 1 0 1 1 1 1
128 1 0 1 1 0 1 1 1 1 1
1 1 0 0 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 0
Message Hiding Stage:Message encryption
The embedding procedure contains five phases.
Message encryption
Image preprocessing
Secret message embedding
JPEG entropy coding
JPEG stego-image generation

Message encryption: The first phase begins by encrypting the


message M by data encryption (RSA) algorithm with a key k(public
key of Receiver). The encrypted result is called the secret
message = {s1, s2, s3, , sm} where si is a secret bit containing 0
or 1 and m is the length of .

24
Image preprocessing
In the second phase the proposed method use JPEG Image
preprocessing method upon cover image. For this partition a cover-
image O into non overlapping blocks of 8 X 8 pixels, and then use the
DCT(Discrete cosine transform) to transform each block into DCT
coefficients. The DCT coefficients are then scaled with a modified
quantization table. The quantization table is listed in Fig below. This
table is notably different from the quantization table of JPEG.
This is because the secret 16 11 10 16 1 1 1 1
message will be embedded in the 12 12 14 1 1 1 1 55
middle-frequency part of the 14 13 1 1 1 1 69 56
quantized DCT coefficients. This 14 1 1 1 1 87 80 62
new quantization table is obtained 1 1 1 1 68 109 103 77
by changing middle elements by 1 1 1 64 81 104 113 92
one in original quantization table. 1 1 78 87 103 121 120 101
1 92 95 98 112 100 103 99

Fig 4. Modified quantization table 25


Image preprocessing
If using the standard quantization table to quantize and dequantize DCT
coefficients, then majority of middle frequency quantized DCT
coefficients will be 0 and therefore, the image quality is degraded,
especially when the cover-image undergoes a high compression ratio. If
there are many quantized coefficients equal to 0, then the message
capacity will be also decreased therefore, to increase message capacity
and quality of image the quantization table of JPEG needs to be
modified.

To increase quality of stego image secret message is hidden by using


modified Fibonacci series with encoder/decoder method, in this method
a change in single bit in DCT coefficients hides three bit in single DCT
coefficients with minimal change in that coefficient

26
Secret message embedding
In the third phase, the secret message will be embedded in the
middle frequency part of the quantized DCT coefficients for each
block Oi.

Let Ci be the modified quantized DCT coefficients, and let Ci[a,b]


denote the value of the ath row and bth column coefficients of the block
Ci.

Each coefficient in the middle-frequency part will embed three secret


bits (using modified Fibonacci number encoding/decoding method) to
increase the message load of the stego-image.

27
Secret message embedding
This method embeds S1,S2 and S3 into C1[0,4], S4,S5 and S6 into
C1[0,5], S7,S8 and S9 into C1[0,6], S10,S11 and S12 into C1[0,7], S13,S14
and S15 into C1 [1,3], and so on. The embedding order is listed in Fig 5
below

So each 8 x 8 pixel
block hides 26 x 3bit=78
bit encrypted message

Fig 5. Embedding sequence.


28
JPEG entropy coding
Then compress the embedded Ci in the fourth phase. After the secret
message is embedded in each block, then employ the JPEG entropy
coding (that contains Huffman coding and Run-Length coding) to
compress each block. For each block after the entropy coding, The
JPEG file is obtained that contains a quantization table p and some
compressed data. That is stego-image which satisfies the JPEG
standard

JPEG stego-image generation


In the fifth phase, The JPEG stego-image E is obtained as output and
which is transferred to the receiver

29
Message Extracting Stage
The extracting procedure contains three phases.

1. JPEG entropy decoding


2. Secret message extracting
3. Decryption of the secret message

After receiving the JPEG stego-image from the encoder, decode the
compressed data in the JPEG file by using the inverse entropy coding.
The JPEG stego-image file contains a quantization table and all the
compressed data. The inverse JPEG entropy coding contains Huffman
decoding and Run-Length decoding. Each block Ci can be
reconstructed after all the compressed data are decoded.

30
Message Extracting Stage
Next, extract the secret bits from the 26 middle-frequency coefficients
Ci[0,4],Ci[0,5],Ci[0,6],Ci [0,7], Ci[1,3],Ci[1,4],Ci[1,5],Ci[1,6],Ci[2,2],
Ci [2,3], Ci [2,4], Ci [2,5], Ci [3,1], Ci [3,2],Ci [3,3],Ci [3,4],Ci [4,0],
Ci [4,1], Ci [4,2], Ci [4,3], Ci [5,0], Ci [5,1], Ci [5,2], Ci [6,0], Ci [6,1],
and Ci [7,0],

where 1 i (N/8 X N/8).

Then collect these bits to regenerate the secret message .

The proposed method then imports the secret key k to the decryption
method to decrypt the secret message. Finally, the extraction of the
original message M is achieved.

31
TEST AND RESULTS
Test and Results
The testing is performed by taking the secret text of varying length and
the cover-image (Polar Bear Image) (256*173). Figure 6.1 shows the
cover image before encryption and hiding. Figure 6.2 shows the stego-
image after extracting and decryption. Figure 7.1 and 7.2 shows same
test with another image (Fighter Jet Image).

Percentage Change for SNR is calculated by the formula


DCTSNR LSBSNR
Percentage Change for SNR = 100 (9)
LSBSNR

33
Fig. 6.1Polar Bear Image Before Stegnography Fig. 6.2.Polar Bear Image After Stegnography

Fig. 7.1. FighterJet Image Before Stegnography Fig. 7.2 Fighter Jet Image after Stegnography
Fig. 8. Graph Showing Result SNR versus No of character in text file for LSB and proposed DCT
for Polar Bear Image

Fig. 9. Graph Showing Result SNR versus No of character in text file for LSB and proposed DCT
for FighterJet Image
Fig. 10. Graph Showing Result PSNR versus No of character in text file for LSB and proposed
DCT for Polar Bear Image

Fig. 11. Graph Showing Result PSNR versus No of character in text file for LSB and proposed
DCT for FighterJet Image
Test and Results
Average Percentage Average Percentage
Image
Change for SNR Change for PSNR

Polar Bear 68.87634 54.70928

Fighter jet 36.70575 26.48517

Image SNR value range PSNR value range

Polar Bear (35- 39) (45-58)

Fighter jet (32- 34) (20-27)

Results of this work demonstrate that Average percentage improvement of


SNR is nearly 50
37
Conclusions
This work is implemented using DCT based image steganography algorithms
using Modified Fibonacci Series Decoder (MFSD) which add complexity to
make it difficult to extract information by the intruder. Also a cryptography
algorithm is used, which provides more complexity. A number of conclusions
derived from this study
1. Using cover images and a secret message with different lengths are that
SNR values of the proposed method is nearly 50 percent higher as
compared to LSB technique
The SNR value decreases with the increase in length of the secret
message.
This method embedded the secret message in the middle-frequency part
of the quantized DCT coefficients. The experimental results show the
proposed method provides acceptable image quality and a large
message capacity than LSB technique
It is observed that the proposed method has high level of security by
using RSA algorithm
38
Future Scope
1. The method of embedding is DCT transform insertion, in the future
another embedding method should be employed like wavelet or
Sparta spectrum methods.

2. The Encryption method could be replaced by other public keys


ciphering algorithm.

39
Rreferences
[1] W. Stallings, Cryptography and Network Security: Principles and
Practice, third ed., Pearson Education, New Jersey, 2003.
[2] N. F. Johnson and S. Katzenbeisser, .A survey of steganographic
techniques, Information Hiding, pp.43-78. Artech House,
Norwood, MA, Journal,2000.
[3] Lou, D. C. and Liu, J. L.. Steganography Method for Secure
Communications. Elsevier Science on Computers& Security, 21,
5:pp. 449-460, 2002.
[4] J. Fridrich and M. Goljan,Practical steganalysis of digital images-
state of the art, Proc. SPIE Photonics West, San Jose, California,
Vol. 4675, pp. 1-13, Jan. 2002.
[5] Moerland, T., Steganography and Steganalysis, Leiden Institute
of Advanced Computing Science,www.liacs.nl/home/
tmoerl/privtech.pdf
40
41

You might also like