You are on page 1of 7

See

discussions, stats, and author profiles for this publication at: https://www.researchgate.net/publication/224250353

New Data Hiding Algorithm in MATLAB Using


Encrypted Secret Message
Conference Paper July 2011
DOI: 10.1109/CSNT.2011.64 Source: IEEE Xplore

CITATIONS

READS

1,180

5 authors, including:
Asoke Nath
St. Xavier's College, Kolkata
195 PUBLICATIONS 493 CITATIONS
SEE PROFILE

All in-text references underlined in blue are linked to publications on ResearchGate,


letting you access and read them immediately.

Available from: Asoke Nath


Retrieved on: 24 June 2016

2011 International Conference on Communication Systems and Network Technologies

New Data Hiding Algorithm in MATLAB using Encrypted secret message


Abhirup Kumar Sen
Department of Computer Science
St. Xaviers College (Autonomous), Kolkata
Kolkata, India
e-mail: abhirup_kr_sen@yahoo.com

Agniswar Dutta
Department of Computer Science
St. Xaviers College (Autonomous), Kolkata
Kolkata, India
e-mail: agnispeaks@gmail.com

Sankar Das

Shalabh Agarwal

Department of Computer Science


St. Xaviers College (Autonomous), Kolkata
Kolkata, India
e-mail: dassankar16@yahoo.co.in

Department of Computer Science


St. Xaviers College (Autonomous), Kolkata
Kolkata, India
e-mail: shalabh@sxccal.edu

Asoke Nath
Department of Computer Science
St. Xaviers College (Autonomous), Kolkata
Kolkata, India
e-mail: asokejoy@gmail.com

AbstractIn the present work the authors have


introduced a new method for hiding any encrypted
secret message inside a cover file. For encrypting secret
message the authors have introduced a new bit
exchange algorithm. For hiding secret message Nath et
al(1,2,3) have already proposed various methods. Here
the authors modified the steganographic method.
Instead of changing the LSB of the cover file at a stretch
the authors proposed to change LSB and LSB+3 bits
and changing alternate bytes of the cover file. It means
to hide one byte of secret message the authors used 8
bytes of the cover file but out of 8 bytes 4 bytes were
modified in LSB and LSB+3 bit positions and the
alternate bytes remain unchanged. The secret message
was encrypted by using a simple bit exchange method
before the actual embedding process starts. The number
of times the secret message to be encrypted using bit
exchange method can be controlled by the user. The
proposed bit exchange method is reversible that means
the way the encryption done the decryption to be done
in reverse way. The entire work was done in MATLAB.
The authors applied the present steganography
algorithm on different cover files such as image file,
audio file, video file, word file, Excel file, Power point
file, .exe file and in every case the result found was
satisfactory. To embed any secret message inside a
cover file the user has to enter a password and the same
password to be used to unhide the secret message. The
authors propose that this
method could be most
appropriate for hiding any file in any standard or non
standard cover file such as word, excel, .ppt, .exe,
image, audio, video files. The hidden message is
encrypted using some bit exchange method and hence it
will be almost impossible for the intruder to unhide the
actual secret message from the embedded cover file.
This method may be used for sending some secret key to
someone over mail as the intruder may not be able to
unhide and to decrypt the secret message.

978-0-7695-4437-3/11 $26.00 2011 Crown Copyright


DOI 10.1109/CSNT.2011.64

[keywords:steganography,MSA,LSB,encry
ption,decryption]
I.

INTRODUCTION

The steganography is now a very important topic


especially when someone wants to send confidential
message from one computer to another computer may
be through internet. In steganography we try to hide
some secret message which may be some text or
image or even audio clip in some host file or the cover
file. The cover file may be some image, audio, word
or some word file. There are quite a number of
steganography methods are available. Initially while
hiding secret message we do not encrypt the secret
message but the security of those methods were very
little and hence now the people are using encrypted
secret message to embed in the cover file (2, 3).
Recently Nath et al (2, 3) used encrypted secret
message using MSA algorithm (4). Nath et al (2, 3)
used the methods changing LSB bits in the cover file.
In the present work we have used different encryption
algorithm which is essentially bit exchange method
and we have inserted in LSB and LSB+3 bits in
alternate bytes. It means to embed one byte secret
message we have used 8 bytes and out of 8 bytes we
use 4 alternate bytes and the other four bytes we did
not use. This method may be extended further to
embed bytes in the cover file in random manner which
may make the steganography method more secured.
The present work used of two (2) distinct methods :
(i) to encrypt the secret message(SM) using new bit
exchange method, (ii) We insert the encrypted secret
message inside the cover file(CF) by changing the
262

least significant bit(LSB) and LSB+3 bits in every


alternate bytes of the cover file. Nath et al(1,2,3)
already proposed different methods for embedding
SM into CF but there the SF was inserted in the cover
file at a stretch but in the present method we have
inserted the encrypted SF in every alternate byte of
the cover file.
We found that this method is very effective in hiding
small SF in any non-standard cover file such as word
file, pdf file, .exe file. Assume a situation where one
can hide the answer of the entire question paper
within the question paper itself. In the present work
we have basically tried to make the steganography
method more secured. It means even if someone can
extract SM from CF but it cannot be decrypted as one
has to know the exact decryption method. In our
present work we try to embed almost any type of file
inside some standard and non-standard cover file(CF)
such as image file(.JPEG or .BMP) or any image file
inside another image file or some small secret
message inside some word file or excel file or some
power point slide or in some .exe file.

In the present work we perform maximum of 5-bits


right shift. But the user can take more bits for right
shift operation to make the secret file more random.
Now we describe the entire encryption method on
three (3) bytes say AAS.
Binary representation of A (ASCII code=6510)
=010000012
Binary representation of S (ASCII code=8310 )
=010100112
Now we will execute the above proposed method on
AAS for 2 right shifts:
TABLE I. BIT EXCHANGE METHOD USING 2 BITS RIGHT SHIFT

We can see that the pattern AAS is modified to


after we apply 2 bits right shift. These changes will
be more significant if perform more right shift
operations supplemented by XOR operation.

II. METHODS USED FOR EMBEDDING SECRET MESSAGE


FILE IN THE COVER FILE

To embed a secret message file in the cover file we


have
A
A
0
1
0
0
0
0
0
1
0
1
0
0
0
used
1
0
1
0
0
0
0
0
1
0
1
0
0
two
1
0
1
0
1
0
1
0
1
0
1
0
1
distin
ct
1
1
1
0
1
0
1
0
1
0
1
0
1
1
1
1
0
0
1
0
0
1
0
1
0
0
meth
ods:
(ASCII Code=228)

Remarks

0
0
0

0
0
1

1
0
0

0
1
1

1
0
0

0
1
1

1
0
0

0
1
0

0
0
0

1
0
1

1
1
1

0
0

1
0

0
0

1
1

0
0

1
1

0
0

1
0

0
0

0
1

0
0

(ASCII Code=160)

(1) W
e encrypt the secret message file using simple bit
shifting and XOR operation in the secret
message file.

Original bits
Right shift by 1-bit
XORing left 4 bits with right 4 bits
and substituting in right 4-bits
Right shift by 2-bits
XORing left 4 bits with right 4 bits
and substituting in right 4-bits

(ASCII Code=162)

In the decryption process we follow the reverse


process as follows:
(i)

(2) The encrypted secret message we embed in the


cover file in alternate byte. We substitute bits in
LSB and LSB+3 bits in the cover file.

(ii)
(iii)

Let us now describe our proposed bit-exchange


encryption method and then we will describe the
steganography algorithm.
A. Bit Exchange method(=AAA method) : We
have introduced a simple bit shifting method
for encrypting any file: The following are the
steps in AAA encryption method:
Step-1: Read one by one byte from the secret
message file and convert each byte to 8-bits.
Then we apply 1 bit right shift operation on
the entire file so that each byte will be
modified accordingly.

Step-3: Repeat step-1 by performing 2 bits


right shift for all bytes in the secret message
file. Then repeat step-2 again.

(iv)

We perform XOR operation with left 4 bits


with right 4-bits in one byte and then
substitute the result on the right 4-bits.
We give 2 bits left shift operation
We again perform XOR operation with
left 4-bits with right 4-bits in one byte
and then substitute the result on the right
4-bits.
We give 1 bit left shift operation to get
back original secret message.

B. Steganography Algorithm:
In the present work we have use the substitution of
LSB and LSB+3 bits of the cover file in alternate
bytes. The last 300 bytes of the cover file we use for
embedding password, size of the secret message file.
After that we start to embed the secret message file.
We read one byte from encrypted secret message file
and convert it into 8 bits and then we take 2 bits of
the encrypted secret message and substitute the LSB
and LSB+3 bits of the cover file and then leave one
byte of the cover file intact. Then again substitute 2
bits. The same process we repeat for all 8 bits of the

Step-2: We read 8 bits at a time and divide


into two blocks 4 bits each and then perform
the XOR operations with 4-bits on the left
side with 4 bits on the right side and
substitute the new bits in right 4-bit positions.
The same thing repeated for all bytes in the
file.

263

secret message. Now we will show how we embed


the bit pattern of encrypted A(= =11100100) as
shown
Original Original Bit pattern of the cover File
in table- Byte
1 in a A
0
1
0
0
0
0
0
1
B
0
1
0
0
0
0
1
0
cover
C
0
1
0
0
0
0
1
1
file
D
0
1
0
0
0
1
0
0
which
E
0
1
0
0
0
1
0
1
contains F
0
1
0
0
0
1
1
0
G
0
1
0
0
0
1
1
1
the
0
1
0
0
1
0
0
0
followin H
g characters ABCDEFGH
In table-2 we have shown how the bit patterns of
we have embedded in 8 bytes of Cover file. The
original File which contains ABCDEFGH is
modified to @BCDLFPH.
Here we can see that out of 8 bytes only 3 bytes get
changed and the 5 bytes remain unchanged after we
embed 1 character. Here the change is prominent as
we embed in text characters but if we do the same in
some image then the changes made here will not be
very significant as our eye will not be able to
differentiate between two colors. To embed secret
message we have to first skip 300 bytes from the last
byte of the cover file. After that we start to embed
bits of the encrypted secret message into the cover
file. The size of the secret message file must be less
than 10% of the cover file. For .EXE or .DOC file the
size of the secret message file must be 1-5% of the
cover file.

Bits
to
substitute

Embedded Bit pattern of cover File

ASCII
code

Modified
Byte

0,0
-0,1
-1,0
-1,1
--

0
0
0
0
0
0
0
0

64
66
67
68
76
70
80
73

@
B
C
D
L
F
P
H

1
1
1
1
1
1
1
1

0
0
0
0
0
0
0
0

0
0
0
0
0
0
0
0

0
0
0
0
1
0
1
1

0
0
0
1
1
1
1
0

0
1
1
0
0
1
1
0

0
0
1
0
0
0
1
0

following combinations are most successful:


TABLE III. COVER FILE TYPE AND SECRET MESSAGE FILE TYPE
Sl.
No.
1

Cover
file type
.BMP

2.
3.
4.
5.
6.

.JPG
.DOC
.WAV
.AVI
.EXE

Secret file type used


.BMP,.DOC,.TXT,.WAV,.MP3,.XLS,.PPT,
.AVI,.JPG,.EXE..COM
Any small file.
Any small file
.BMP,.JPG,.TXT,.DOC
.TXT,.WAV,.JPEG
Any small file

*size of secret message should be less 10% of cover file

Only in case of .PDF and .JPEG file to insert secret


message is a bit difficult job as those files are either
compressed or encrypted. Even then we got success
for inserting a small text file in .PDF file. So we can
conclude that .PDF file is not a good cover file. On
the other hand .BMP file is the most appropriate file
which can be used for embedding any type of file
without facing any problem.

To make the system more secured we have


introduced the password while embedding an
encrypted secret message file. If password is correct
then the program will read the file size from the
cover file and start to work on the cover file. To
extract the secret message we perform exactly the
reverse process of the encryption method. The
program first matches the password. If it is correct
then it will read the size of the secret message file
from the embedded cover file. Then it will read 8
bytes and extract 8 bits from 4 alternate bytes and
convert them to a character and write onto an external
file. Once all bytes extracted from the cover file then
we run the decryption program to get the original
secret message file.

III. RESULTS AND DISCUSSION:


We applied our present method on different
cover files and secret message files and the
results are given below:

TABLE II: EMBEDDING ENCRYPTED A(=) IN COVER FILE

We made a long experiment on different types of host


files and also the secret messages and found the

Case-1: Cover File type=.jpg secret message file =.jpg

264

Fig_1:Cover file name: photo.jpg


Fig_2:Secret message File:joy1.jpg
name :photo.jpg Size=2731822 Bytes
Size=1870 Bytes
(secret message encrypted before embedding)

Case-2: Cover File type=.BMP

secret message file =.doc

Fig_4: Cover File name :blue.bmp


Size= 1440054 Bytes.

Case-3: Cover File type=.BMP

Fig_3: Embedded Cover file


Size=2731822 Bytes

Fig_5: Secret message


File Name: clc.doc
File Size: 26624 Bytes

Fig_6: Embedded Cover


Filename: blue.bmp
Size= 1440054 Bytes

secret message file =.jpg

Fig_7: Cover file name = desert.bmp Fig_8: Secret message file=


Fig_9: Embedded cover file
(size=(2359350B)
Sunset.jpg(size=71189B)
name=desert.bmp
(The encrypted secret message file is embedded)
(size=(2359350B)

Case-4: Cover File type=.AVI(Movie File)

secret message file =.pdf

+
Fig_10: Cover File
Name=rhionos.avi.
(Size=76800B)

Fig_11: Secret message File


Fig_12:Embedded Cover File
name = myfile1.pdf
Name=rhinos.avi
(size=15304B)
(size=76800B)
(The encrypted secret message file is embedded )

Case-5: Cover File type=.doc

secret message file =.txt

265

+
Fig_13: Cover File
Name=clc.doc.
(Size=26624B)

Fig_14: Secret message


Fig_15:Embedded Cover File
File name = aa.txt
Name=clc.doc
(size=15304B)
(size=26624B)
(The encrypted secret message file is embedded )

Case-6: Cover File type=.exe

secret message file =.txt

+
Fig_16: Cover File
Name=mshearts.exe
(Size=126976B)

Fig_17: Secret message


Fig_18:Embedded Cover File
File name = aa.txt
Name= mshearts.exe
(size=15304B)
(size=126976B)
(The encrypted secret message file is embedded )

Case-7: Cover File type=.ppt

secret message file =.txt

+
Fig_19: Cover File
Name=power.ppt
(Size=99328B)

Fig_20: Secret message


Fig_21:Embedded Cover File
File name = aa.txt
Name= power.ppt
(size=15304B)
(size=99328B)
(The encrypted secret message file is embedded )

Case-8: Cover File type=.mp3

secret message file =.txt

+
Fig_22: Cover File
Name=Bin.mp3
(Size=10337178B)

Fig_23: Secret message


Fig_24:Embedded Cover File
File name = aa.txt
Name= Bin.mp3
(size=15304B)
(size=10337178B)
(The encrypted secret message file is embedded)

TABLE III : LISTING OF COVER FILES AND SECRET MESSAGES WITH THE TIME REQUIRED TO
EMBED ENCRYPTED SECRET MESSAGE FILE
Sl.
No.

Cover file
Name

1.

photo.jpg
image)

2.

(8 MP

Secret message
Size

Name

Time
Size

Encoding

Decoding

2.60 MB

joy1.jpg

1870 bytes

5 sec

5 sec

clc.doc

26.0 KB

aa.txt

150 bytes

0.5 sec

0.5 sec

3.

Blue.bmp

1.37 MB

clc.doc

26.0 KB

1 min

4.

mshearts.exe

124 KB

aa.txt

150 bytes

0.5 sec

0.5 sec

5.

rhinos.avi

25 MB

myfile1.pdf

14.9 KB

40 sec

40 sec

266

7 sec

1 min
sec

6.

Bin.mp3

9.85 MB

clc.txt

934 bytes

3 sec

3 sec

7.

power.ppt

97.0 KB

aa.txt

150 bytes

0.5 sec

0.5 sec

8.

desert.bmp

2.25 MB

sunset.jpg

69.5 KB

3 min
sec

3 min
sec

IV. CONCLUSION
[2]Advanced steganographic approach for hiding
encrypted secret message in LSB, LSB+1, LSB+2
and LSB+3 bits in non-standard cover files, Joyshree
Nath, Sankar Das, Shalabh Agarwal and Asoke
Nath , International Journal of Computer
Applications(0975-8887)
Vol 14-No7, Feb 2011

In the present work we try to embed some secret


message inside any cover file in encrypted form
so that no one will be able to extract actual secret
message. The program developed in MATLAB.
We embed LSB and LSB+3 bits of the cover file
in every alternate byte position. The encryption
of the secret message file here we have taken 5
times but one can go up to any limit. But if we
increase the encryption number then the process
becomes slow but the encryption will be very
strong. In principle it will be difficult for any one
to decrypt the encrypted message without
knowing the exact encryption method. Our
method is essentially stream cipher method and
it may take huge amount of time if the files size
is large and the encryption number is also large.
This present method may most suitable for water
marking. The steganography method may be
further secured if we compress the secret
message first and then encrypt it and then finally
embed inside the cover file.

[3] Advanced Steganography Algorithm using


encrypted secret message, Joyshree Nath and Asoke
Nath, International Journal of Advanced Computer
Science and Application (IJACSA)
Vol-2 No.3, Page 19-24, March (2011).
[4] Symmetric key cryptography using random key
generator,
A.Nath,
S.Ghosh,
M.A.Mallik,
Proceedings of International conference on SAM2010 held at Las Vegas(USA) 12-15 July, 2010,
Vol-2, P-239-244
[5] New Steganography algorithm using encrypted
secret message, Joyshree Nath, Meheboob Alam
Mallik , Saima Ghosh and Asoke Nath, Accepted for
publication in Worldcomp-2011 to be held at Las
Vegas,USA from 18/07/2011 to 21/07/2011\

ACKNOWLEDGMENT
The authors sincerely express their gratitude to
Department of Computer Science for providing
necessary help and assistance. AN is also
extremely grateful to University Grants
Commission for providing fund for continuing
minor research project on Data encryption using
symmetric key and public key crypto system.
The authors are very much grateful to all current
students of semester-6 Computer Science
Honours for their constant encouragement during
the progress of this research project.

[6] A Challenge in hiding encrypted message in LSB


and LSB+1 bit positions in various cover files,
Joyshree Nath ,Sankar Das, Shalabh Agarwal and
Asoke Nath, accepted for publication in JGRCS, 5
May 2011
[7] Steganography in Digital Media Principles,
Algorithms, and Applications- Jessica Fridrich,
Cambride University Press, 2010.
[8] Jpeg20000 Standard for Image
Compression
Concepts algorithms and
VLSI Architectures
by Tinku
Acharya and Ping-Sing Tsai, Wiley
Interscience.

REFERENCES
[1] Data Hiding and Retrieval, A.Nath, S.Das,
A.Chakrabarti, Proceedings of IEEEInternational
conference on Computer Intelligence and
Computer Network held at Bhopal from 26-28
Nov, 2010.

[9] Steganography and Seganalysis by Moerland, T,


Leiden Institute of Advanced Computing Science.

267

You might also like