Page 1
International Journal of Computer Engineering and Technology (IJCET), ISSN 0976-
6367(Print), ISSN 0976 – 6375(Online) Volume 4, Issue 4, July-August (2013), © IAEME
150
AN EFFICIENT HASH BASED STEGANOGRAPHY TECHNIQUE FOR
TEXT MESSAGE USING COLOR IMAGES
Saurabh Singh1, Dr. Ashutosh Datar
2
1PG Student, Department of Electronics & Communication Engineering, S.A.T.I. Vidisha,
INDIA (M.P.) 2Head, Department of Bio-Medical Engineering, S.A.T.I. Vidisha, INDIA (M.P.)
ABSTRACT
In this paper, a hash based approach for color image Steganography using canny edge
detection method is proposed. One of the advantages of using edge detection technique is to secure
the data. For encoding the text data in an image Steganography procedure is followed. Edge
detection is done by canny method and then hash function is used to embed text data in the RGB
color image. The hash is a fast and secure approach for image Steganography. This found that canny
edge detection offers superior performance for detecting edges in an image. Large edge detected
image is preferred for secure Steganography. The proposed method provides a better security and
supports different types of file format like-jpg, jpeg, bmp, tiff etc.
Keywords: Edge detection, Steganography, Encoding & Decoding, Hash function.
I. INTRODUCTION
Steganography (Steganos-“Covered”, Graphie-“Writing”) is the art and science of writing
hidden messages in such a way that no one apart from the intended recipient knows of the existence
of the message [1]-[5]. The first step in embedding and hiding information is pass both the secret
message and the cover message into the encoder. Inside the encoder, one or several protocols may be
implemented to embed the secret information into the cover message. The type of protocol will
depend on the information in fig.1. contents to be embedded.
INTERNATIONAL JOURNAL OF COMPUTER ENGINEERING &
TECHNOLOGY (IJCET)
ISSN 0976 – 6367(Print) ISSN 0976 – 6375(Online) Volume 4, Issue 4, July-August (2013), pp. 150-162 © IAEME: www.iaeme.com/ijcet.asp Journal Impact Factor (2013): 6.1302 (Calculated by GISI) www.jifactor.com
IJCET
© I A E M E
Page 2
International Journal of Computer Engineering and Technology (IJCET), ISSN 0976-
6367(Print), ISSN 0976 – 6375(Online) Volume 4, Issue 4, July-August (2013), © IAEME
151
Figure.1. Block diagram of Steganography
For example, an image protocol is used to embed information inside images. A key is often
needed in the embedding process. This can be in the form of public or private key to encode the
secret message with sender private key and the recipient can decode it using sender public key. In
embedding the information this way, the chance of a third, party attacker getting hold of the Stego-
object and decoding it to find out the secret information is greatly reduced.
Hence, the embedding process inserts a mark M in the object I. Random number generator is
generally used to produced a key K, which is embedded in I. Hence, the marked object I is generated
as: � � � �� � �
The output of the encoder will be a Stego object contains original cover image and embedded
secret information. The Steganography algorithm must ensure that the Stego object bear a very close
resemblance to original cover object. The Stego object then may be sent through usual
communication channels to intended recipients. The Stego object at receiver end must be decoded to
retrieve the secret information. In decoding process, Stego object is decoded with the help of the
public or private key. Depending upon the encoding technique, sometimes the original cover image
is also needed in decoding process. After successful decoding, the embedding secret information
may be extracted and viewed. There are many algorithms available for image Steganography.eg.
LSB (Least significant bit) method, masking etc. LSB method is simple and popular method but its
security aspect is poor. Hash function based approach is robust and convenient. A hash function
converts variable lengths data of fixed length. The hash function returns hash codes or checksum or
simple hashes. [Some more about hash function coding and decoding].
II. EDGE DETECTION
Edge in an image contains shape information. Edges represent abrupt transition of gray level in
an image. The edge detection is the process of finding such transition, which represents some
physical boundary in the scene [6]–[11]. The goal of edge detection is to obtain a line drawing of the
scene in an image, so as to further extract information regarding important features [Fig.2.]. This
information may then be used in pattern recognition algorithms. Below figure shows the edge
detection example-
Cover
Secret
Message
Image
Encoder
Stego
Cover
Secret
Message
Decoder
Key Key
Page 3
International Journal of Computer Engineering and Technology (IJCET), ISSN 0976-
6367(Print), ISSN 0976 – 6375(Online) Volume 4, Issue 4, July-August (2013), © IAEME
152
Figure.2. Edge detection example
Basic steps in edge detection-
1) Smoothing: Noise removal/ suppression with preservation of edges.
2) Enhancement: Sharpening of edges by filtering.
3) Detection: Determination with certainty if pixel belongs to an edge or not.
4) Localization: Determining exact location of edge.
There are various operators which are used in edge detections. Some note worthy edge detectors are-
1) Robert Edge Detection
It is one of early detector, which is simply and efficient. It highlights region of high spatial
frequency which may usually corresponds to edges. It then assign pixels values in output images;
correspond to estimated complete magnitude of spatial gradient of the input image.
2) Sobel Edge Detection
It is central difference based operator giving higher weight to central pixel. It is an
approximation of first order derivative of Gaussian kernel. Sobel operators which are shown in the
masks below:
3) Prewitt Edge Detection
It is also based on central difference where operator measures two components. Vertical edge
components and horizontal edge components for current pixel.
Saurabh.jpeg
Page 4
International Journal of Computer Engineering and Technology (IJCET), ISSN 0976-
6367(Print), ISSN 0976 – 6375(Online) Volume 4, Issue 4, July-August (2013), © IAEME
153
4) Kirsch Edge Detection
This operator or compass kernel is a non-linear edge detector. It finds maximum edge
strength in predetermine direction. It is represented by the mask:
E � ��3 �3 5�3 0 5�3 �3 5 NE � ��3 5 5�3 0 5�3 �3 �3
N � � 5 5 5�3 0 5�3 �3 �3 NW � � 5 5 �35 0 �3�3 �3 �3
W � �5 �3 �35 0 �35 �3 �3 SW � ��3 �3 �3 5 0 �3 5 5 �3
S � ��3 �3 �3�3 0 �35 5 5 SE � ��3 �3 5�3 0 5�3 5 5
5) LoG (Laplacian of Gaussian) Edge Detection
This operator has smoothing effects through convolution with Gaussian shape kernel. It is
followed by application of laplacian operator.
G� = � 0 �1 0�1 4 �1 0 �1 0 and G� = ��1 �1 �1�1 8 �1�1 �1 �1
6) Canny Edge Detection
Canny edge detector is an optional edge detector algorithm which has good detection, good
localization capability with minimal response. The problem with above edge detector is that the
detected edge may not be complete due to noise, breaks in edges from non-uniform illumination,
unwanted effects due to spurious intensity is discontinuity etc. Hough transform is one of the popular
approaches to link edge pixels into meaningful edges. The Hough transform [12]-[15] has two steps:
1. Peak detection- For each detected peak the location of non-zero pixels that contributes to
that peak is determined.
2. Line detection and linking: After the peaks are identified, there corresponding line
segments with starting and ending points are determined.
Figure.3. Hough transform based edge detection
Page 5
International Journal of Computer Engineering and Technology (IJCET), ISSN 0976-
6367(Print), ISSN 0976 – 6375(Online) Volume 4, Issue 4, July-August (2013), © IAEME
154
III. HASH FUNCTION
To create a digest of the message, hash function [16]-[18] is used. The hash function creates a
fixed digest from a variable –length message (fig.4).
Figure.4. Signing the digest
The two most common hash functions are called MD5 (Message Digest 5) and SHA-1
(Secure Hash Algorithm 1). The first one produces a 120-bit digest. The second produces a 160-bit
digest. Hash functions have must two properties to guarantee it success.
1. Hashing is one-way; the digest can only be created from the message, but not vice-versa.
2. Hashing is one-to-one function; there is little probability that two message will create the same
digest.
One practical use is a data structure called a hash table where the data is stored associatively.
Searching for a person's name in a list is slow, but the hashed value can be used to store a reference
to the original data and retrieve constant time (barring collisions). It is easy to generate hash values
from input data and easy to verify that the data matches the hash, but hard to 'fake' a hash value to
hide malicious data. Hash functions are also used to accelerate table lookup or data comparison tasks
such as finding items in a database, detecting duplicated or similar records in a large file, finding
similar stretches in DNA sequences, and so on.
Different types of hash function are available but most types of hashing function the choice
of the function depends strongly on the nature of the input data. Types of hash function-
1. Trivial hash function
2. Perfect hash function
3. Minimal perfect hash function
4. Cryptographic hash function
5. Hashing with checksum
6. Hashing variable length data
7. Modulus hash function etc.
In this paper, Modulus hash function has been used that is the mod of the division hash
function could be h = z mod n (the remainder of z divided by n). This is the combination of addition,
subtraction, multiplication and division function.
It is of two types:
1. Symmetric hash function-This type of hash function ensure that sender and receiver used the same
key for data encoding and decoding.
2. Asymmetric hash function- This type of hash function ensure that sender and receiver used the
different keys for data encoding and decoding.
In our methodology, symmetric modulus hash function has been used for text data hiding and
retrieval purpose in the Red, Green and Blue pixels of the image.
Message
Hash
function
Message
Digest
(Variable length) (Fixed Length)
Page 6
International Journal of Computer Engineering and Technology (IJCET), ISSN 0976-
6367(Print), ISSN 0976 – 6375(Online) Volume 4, Issue 4, July-August (2013), © IAEME
155
IV. APPROACH FOR STEGANOGRAPHY
This approach allows the user to embed their secret textual information in images in a way
that can be invisible and doesn't degrade or affect the quality of the original image [2]-[4]. Users
want to make their information secure or protect their work from piracy. This approach is able to
manipulate with different file formats e.g. bitmap, jpeg, jpg, gif and tiff etc.
The Steganography steps for the RGB image used in this work are (fig.5).
1. Input Image-An input interface is provided so that a user can input a (bmp, jpg, gif or tiff
etc.) image for hiding personal data for privacy purposes.
2. Input Textual Data- Input the text file containing the textual data which the user wants to
code in the image. The input text file is read by the system.
3. Coding Data in Image-For coding textual data in the image, a hash-based algorithm is used.
Basic purpose of using the hash-based algorithm is to pick pixels randomly to store text data.
The text data are stored in red, blue and green pixel of the employed RGB image. Once the
image is encoded, it is transmitted to intended user.
4. Decoding Data from Image-For decoding textual data in the image, the hash key is used that
was generated during coding. The pixels (red, green, blue byte) values of each position are
read one by one and generated characters concatenated to form a complete message string.
Figure.5. Basic block diagram of color image Steganography using hash algorithm
V. PROPOSED METHODOLOGY
The image and the message are encoded at the sender end. The flow chart for encodings and
decoding are given in fig (6) & fig (7) respectively [19]–[25].
1. Encoding Procedure:
The encoding procedure involves of the RGB image and message string. Application of
canny operator provides edge information, which is linked by using Hough transform. The edge
pixels are identified and are used as a hash key (K). The hash function uses hash key K, input image
and text data to generate pattern. This pattern contains the information regarding position of pixels
for hiding message data. The pixels are chosen from Red, Green and Blue plane of the image. The
output contains encoded image (Stego-object) which is sent to the intended user. The flow chart of
the encoding procedure shown in fig. (6).
Input/output text file and image file
Hash function
Encoded image with
Text data
Decoding Encoding
Decoding Encoding
Page 7
International Journal of Computer Engineering and Technology (IJCET), ISSN 0976-
6367(Print), ISSN 0976 – 6375(Online) Volume 4, Issue 4, July-August (2013), © IAEME
156
Figure.6. Flow chart of the encoding procedure
Check
Remainder
value, in Mod
function
Start
Read RGB
Edge identification and linking
by canny edge detection &
Hough transform
Pixel identification,
Hash key
Read
message
string L
Hash function &
hash digest, I
Is I � L
Modify green
pixel
Modify
blue
Modify
red pixel
Generate Stego-
object End
No Yes
= 1 = 0
Page 8
International Journal of Computer Engineering and Technology (IJCET), ISSN 0976-
6367(Print), ISSN 0976 – 6375(Online) Volume 4, Issue 4, July-August (2013), © IAEME
157
2. Decoding Procedure: It is the reverse process of encoding. In this process received Stego-object
contains original image along with hidden message, which is to be extracted. The input hash key is
used to generate hash values, which contain information about location of pixels where message is
stored. The message string is extracted from Red, Green and Blue pixels of the image. The output
contains extracted text message. The flow chart of decoding the Stego-object is shown in fig. (7).
Figure.7. Flow chart of the decoding procedure
Start
Received Stego
object
Is I � L
Check
Remainder
value in
Mod
function
Read green
pixel data
Read blue
pixel data
Read red pixel
data
Output text
file contains End
Hash function &
hash digest, I
Retrieve
encoded byte
No Yes
= 1 = 0
Page 9
International Journal of Computer Engineering and Technology (IJCET), ISSN 0976-
6367(Print), ISSN 0976 – 6375(Online) Volume 4, Issue 4, July-August (2013), © IAEME
158
VI. IMAGE QUALITY PARAMETER
Image quality is a characteristic of an image that measures the perceived image degradation
(typically, compared to an ideal or perfect image) [5]. Two parameters are there:
1. MSE (Mean square error)
It is defined as the squared difference between the original image and estimated image.
Where: X = original value, = stego value and N = number of pixels
2. PSNR (Peak signal to noise ratio):-
Peak Signal-to-Noise Ratio, often-abbreviated PSNR, is an engineering term for the ratio
between the maximum possible power of a signal and the power of corrupting noise that affects the
fidelity of its representation [10]. Because many signals have a very wide dynamic range, PSNR is
usually expressed in terms of the logarithmic decibel scale. PSNR is most easily defined via
the mean squared error (MSE):
Where: L = maximum value, MSE = Mean Square Error
VII. SIMULATION RESULTS
In the proposed methodology three different color image Lena, Peppers and Baboon of
standard size are used. Simulation results are performed in Matlab2010a version. A comparative of
test images under simulation and encoded images corresponding histograms, detected edges are
shown in fig (8) - fig (12).
The quantitative results are shown in Table-I. On making comparison between original
images and encoded images and their respective histograms. It is evident that no noticeable change is
observed. Hence, it is also observed that the Steganography process did not significantly altered the
image qualities. It is also observed from fig. (10) that Baboon.jpeg offers maximum edge pixels
while the Peppers.jpeg has the lower edge pixels. Hench the PSNR of Baboon.jpeg is higher that two
others except for first case when Lena.jpeg has high value in fig. (13). It may be due to small color
variation in Lena.jpeg. Further, a comparison of results of proposed approach is made with Kritika
et.al. [19]. The proposed method shown superior results in all cases under simulation.
Figure.8. Original images of size 512x512
Lena.jpeg Peppers.jpeg Baboon.jpeg
Page 10
International Journal of Computer Engineering and Technology (IJCET), ISSN 0976-
6367(Print), ISSN 0976 – 6375(Online) Volume 4, Issue 4, July-August (2013), © IAEME
159
Figure.9. Encoded Images with Text Data(2547 Bytes)
Figure.10.After Applying Canny Edge Detection Algorithm
Figure.11. Histogram of original image
Figure.12. Histogram of encoded image with
text data (2547 Bytes)
Lena.jpeg Peppers.jpeg Baboon.jpeg
Lena.jpeg Peppers.jpeg Baboon.jpeg
Lena.jpeg Peppers.jpeg Baboon.jpeg
Lena.jpeg Peppers.jpeg Baboon.jpeg
Page 11
International Journal of Computer Engineering and Technology (IJCET), ISSN 0976-
6367(Print), ISSN 0976 – 6375(Online) Volume 4, Issue 4, July-August (2013), © IAEME
160
Table I
PSNR Output for text encoding
S.No.
Message
length
Lena �512 � 512�
Peppers �512 � 512�
Baboon �512 � 512� Kritika
et.al.
[19]
Proposed Kritika
et.al.
[19]
Proposed Kritikaet.al.
[19]
Proposed
1.
849
Bytes
46.7704
47.5599
42.4704
43.7486
44.5141
46.5188
2.
1698
Bytes
43.1161
43.7728
39.8468
41.9565
41.4249
44.6801
3.
2547
Bytes
40.4854
41.5473
37.9358
40.3967
37.7590
43.2978
4.
3396
Bytes
39.5810
40.0503
36.7382
39.4238
36.3541
42.3406
5.
4287
Bytes
38.5342
39.6310
35.7352
38.6527
35.1693
41.5895
Graphical Results of Calculated PSNR
Figure.13. The graph shows that as the message length increases PSNR decreases, baboon image
gives better results than Lena and peppers image
38
39
40
41
42
43
44
45
46
47
48
849 1698 2547 3396 4287
Lena
Peppers
Baboon
P
S
N
R
in
(dB)
Message length (Bytes)
Page 12
International Journal of Computer Engineering and Technology (IJCET), ISSN 0976-
6367(Print), ISSN 0976 – 6375(Online) Volume 4, Issue 4, July-August (2013), © IAEME
161
VIII. CONCLUSION
The work proposed an approach for Steganography using RGB image and text message. The
results, in comparison to [19] are superior. In this work, all RGB color planes of image are used for
hiding secret text message without loss of image quality. Hence, this approach offers high message
carrying capacity and high-encoded image quality. The Human Visual System (HSV) cannot detect
these fine changes in original image, made due to Steganography process. Moreover, use of hash
function improves its robustness. Hence, it may be adopted for Steganography using color images.
This Color image (RGB) Steganography technique can be extending to further audio, video etc.
ACKNOWLEDGMENT
The author wish to acknowledge Dr. S.N. SHARMA (Head, Department of E & C
Engineering) for his support.
REFERENCES
[1] J.Krinn. (June 2000). Introduction to Steganography.
[Online]. Available: http://rr.sans.org/covertchannels/steganography.php
[2] W. Bender, “Techniques for Data Hiding,” IBM Systems Journal,vol. 35, no. 7, pp. 313-336,
1996.
[3] Stego Archive. (April, 2001). Steganography Information, Software and News to enhance
your Privacy. [Online]. Available: http://www.StegoArchive.com
[4] W. Qian, G. Huayong, H.Mingsheng, “Steganography and Steganalysis based on digital
image,” in IEEE 4th International Conference on Image and Signal Processing, Shanghai,
15-17 October. 2011, pp.252-255.
[5] S. Singh, et. al., “A new image Steganography based 2k
correctionmethod and canny edge
detection,” in IEEE 5th international Conference. On Information Technology: New
Generation, Las Vegas, New south Veils, 7-9 April 2008, pp.563-568.
[6] D. Marr, E. Hildreth, “Theory of edge detection,” Proc. Royal Society of London, vol. 207,
no. 1167, pp.187–.217, February.1980.
[7] J. Canny, “A computational approach to edge detection,” IEEE Transaction on Pattern
Analysis and Machine Intelligence (PAMI), vol. 8, no. 6, pp. 679-698, June 1986.
[8] D. Ziou, S. Tabbone, "Edge detection techniques: An overview,” International Journal of
Pattern Recognition and Image Analysis, vol.8, no.4, pp.537–559, 1998.
[9] J. Canny, “A computational approach to edge detection,” in IEEE Transaction on Pattern
Analysis and Machine Intelligence, vol.8, no.6, pp. 679-714, June 1986.
[10] D. Ziou, S. Tabbone, "Edge detection techniques: An overview,” International Journal of
Pattern Recognition and Image Analysis, vol.8, no.4, pp.537–559, 1998.
[11] S Jayaraman, S Esakkirajan and T Veerakumar, “Digital Image Processing,” Tata McGraw
Hill Education ptd. Ltd, New Delhi, 7th
,ed., 2012, pp.368-393.
[12] R. S. Wallace, “A modified Hough transform for Line,” in IEEE Computer Vision and
Pattern Recognition (CVPR) Conference, San Francisco, 19-23, June, 1986, pp.665-667.
[13] R. D. Duda, P. E. Hart, “Use of the Hough transform to detect lines and curves in pictures,”
Association of Computing Machinery (ACM), pp.11-15, January 1972.
[14] S. Singh, A. Datar, “Edge Detection Technique Using Hough Transforms,” International
Journal of Emerging Technology and Advanced Engineering, vol.3, no.6, pp.333-337, June
2013.
Page 13
International Journal of Computer Engineering and Technology (IJCET), ISSN 0976-
6367(Print), ISSN 0976 – 6375(Online) Volume 4, Issue 4, July-August (2013), © IAEME
162
[15] Rafael C. Gonzalez, Richard E. Woods and Steven L. Eddins,”Digital Image Processing
Using MATLAB,”Pearson Education ptd. Ltd, Singapore, 3rd ed., 2005, pp.392-425.
[16] From Wikipedia, “Hash function,” July 2010, [Online]. Available:
http://en.wikipedia.org/wiki/Hash_function
[17] Behrouz A. Forouzan,”Data communication and networking,”Tata McGraw-Hill Publication,
2nd ed., 2003, pp.799-800.
[18] William Stallings,” Cryptographic and network security,” Pearson Prentice Hall Publication,
4th ed., 2006, pp.320-375.
[19] K. Singla, S. Kaur, “A Hash Based Approach for secure image stegnograpgy using canny
edge detection method,” International journal of computer science and communication ,
vol.3, no.1,pp.156-157,June 2012.
[20] R. Riasat, I. Sarwar Bajwa, M. Zaman Ali “A Hash Based Approach for Color Image
Steganography,” IEEE 6th International. Conference. on Digital Information Management,
Melbourne, Australia, 26-28 September. 2011, pp. 102-107.
[21] Wen-Jan Chen,et al., “High Payload Steganography Mechanism Using Hybrid Edge
Detector,” Expert Systems with Applications , Elsvier,vol.37, pp. 3292-3301, July 2010.
[22] S. Mohammad Seyedzade, R. Ebrahimi Atani, S.Mirzakuchaki, “A Novel Image Encryption
Algorithm Based on Hash Function,” in IEEE 6th Iranian Conference. on Machine Vision,
Isfahan,27-28 October. 2010, pp.1-6. [23] Mohammad A. Alahmad and Imad Fakhri Alshaikhli, “MOIM: A Novel Design of
Cryptographic Hash Function”, International Journal of Computer Engineering &
Technology (IJCET), Volume 4, Issue 4, 2013, pp. 1 - 19, ISSN Print: 0976 – 6367,
ISSN Online: 0976 – 6375.
[24] Ms. Sonali Meghare and Prof. Roshani Talmale, “Developing and Comparing an Encoding
System using Vector Quantization & Edge Detection”, International Journal of Computer
Engineering & Technology (IJCET), Volume 4, Issue 3, 2013, pp. 503 - 511, ISSN Print:
0976 – 6367, ISSN Online: 0976 – 6375.
[25] Hitashi and Sugandha Sharma, “Fractal Image Compression Scheme using Biogeography
Based Optimization on Color Images”, International Journal of Computer Engineering &
Technology (IJCET), Volume 3, Issue 2, 2012, pp. 35 - 46, ISSN Print: 0976 – 6367,
ISSN Online: 0976 – 6375.