Annual Conference on New Trends in Information & Communications Technology Applications-(NTICT'2017)
7 - 9 March 2017
   An Efficient Image Cryptography using Hash-LSB
     Steganography with RC4 and Pixel Shuffling
                 Encryption Algorithms
                                                        Assist.Lec. May H.Abood
                                                     Computer Engineering dept.
                                             College of Engineering, Al-iraqia University
                                                               Baghdad, Iraq
                                                       may_it2004@yahoo.com
Abstract—for secure data transmission over internet, it is           information about the used key. Decryption algorithm is used
important to transfer data in high security and high                 to reconstruct the original data.
confidentiality, information security is the most important issue       Cryptography recently includes           using advanced
of data communication in networks and internet. To secure            mathematical procedures in encryption and decryption
transferred information from intruders, it is important to
convert the information into cryptic format .Different methods
                                                                     techniques. Cipher algorithms are becoming more complex
used to ensure data security and confidentiality during              daily. There two main algorithmic approaches to encryption,
transmission like steganography and cryptography.                    these are symmetric and asymmetric [1]. In Symmetric-key
     This paper improve information security through developing      Encryption using similar cryptographic key for both
efficient image cryptography algorithm by using encryption with      encryption and decryption. The used keys must to be similar
steganography. The proposed algorithm ensure the encryption          or there can be a Some changes between the two keys .In
and decryption using RC4 stream cipher and RGB pixel shuffling       asymmetric key encryption algorithms the keys used for
with steganography by using hash-least significant Bit (HLSB)        encryption and decryption must be different.
that make use of hash function to developed significant way to       Steganography is the technique that deals with hiding secret
insert data bits in LSB bits of RGB pixels of cover image . The
                                                                     data in some cover media which may be image, audio, or
security evaluations are presented by calculating a peak signal to
noise ratio and mean square error. For secret image, PSNR is
                                                                     video. The word steganography comes from the Greek
infinity and MSE is 0. For cover image, PSNR is about 63             “Seganos”, that mean covered or secret and “graphy” which
db and MSE is about 0.03. The results show that high level of        mean writing or drawing [2].
the similarity exists between the stego-images and cover images               In this paper, cryptography and steganography are
and the same is for secret images and extracted image as             used to ensure security of transmitted data. RC4 and pixel
represented also in In Histogram Analysis of secret images.          shuffling encryption algorithm is used to encrypt the secret
These algorithms is performed by using MATLAB program.               image and Hash-LSB is embedded encrypted image into the
                                                                     selected Least significant bits of RGB image and then sent.in
Index Terms— Cryptography, hash-lsb, Image Encryption, RC4,
                                                                     receiver side the image is reconstructed from stego RGB
pixel, shuffling, Security, stream cipher, Steganography.            image and use RC4 and pixel shuffling decryption algorithms
                                                                     to obtain the original image.
                      I. INTRODUCTION
                                                                                  II. PROPOSED METHODOLOGY
   In recent trends of technology the challenge of improving
Information security is important need when sending and                 The security of data communication and especially images
                                                                     became a significant goal as the network is growing. The
receiving data in the fields of data communication and
                                                                     security of images is an important research field in different
networks.to solve this problems there are several methods
                                                                     trends like data security, secure data transmission and
used to protect data from unauthorized access during                 copyright security. So, Image encryption algorithms and
transmission. Many techniques is used to protect the user            hiding algorithms should be designed to enhance the
data. The most efficient technique is using cryptography and         effectiveness of transmission and keep safety from attacks by
steganography. Cryptography and Steganography are the                the intruders. So, the proposed method can achieve the highest
master areas which take a shot at Information Hiding and             level of data integrity, confidentiality and security.
Security.                                                               In this paper trying to verify the confidentiality of grayscale
   In cryptography, encryption algorithm is the technique of         image that makes uses of pixel shuffling and RC4 stream
converting transferred data into unrecognizable form to              cipher for cryptography and Hash-LSB for steganography.
prevent unauthorized access to data unless knowing specific          The main function of the pixel shuffling is that it involves no
                                                                     modification in the bit values and no expansion of pixels in the
978-1-5386-2962-8/17/$31.00 ©2017 IEEE                               86
     Annual Conference on New Trends in Information & Communications Technology Applications-(NTICT'2017)
                                                         7 - 9 March 2017
end of the encryption and the decryption procedure. Here, the     A. RC4 stream cipher algorithm
pixel values are redesigned and combined moving from their                  In this paper, the RC4 encryption is characterize and
particular positions and then the values are swapped to give      executed. The RC4 is an abbreviation of "Rivest Cipher 4" or
the cipher image which become recognizable [3]. The               "Ron's Code 4"[6]. It uses a variable key length which can
objective of using RC4 stream cipher is to improve the            range between 1 to 256 bytes (8 to 2048 bits) and is utilized to
confidentiality to encryption [4]. Then encrypted data as well    instate a 256-byte state vector S. The key stream is totally
as the cover image passed to the HASH LSB technique.              independent of the used plaintext. It uses a variable length key
HASH-LSB calculate the LSB pixel value to insert the              from 1 to 256 bit to initialize a 256-bit state table. The state
message or file content into the cover image and finally stego-   table is used for subsequent generation of pseudo-random bits
image will be created [2]. On the other hand adding pixel         that is XORed with plaintext to produce the ciphertext [7] as
rearranging to the RC4 cipher will enhance the security of the    shown in fig.2.By applying the same method we again decrypt
combination. When we can implement this system then we            the encrypted image. After the end of this step we again got
can embed secret data easily in cover image without any           the original image back.
noticeable change in original image. So intermediate person            In RC4 encryption algorithm, the encryption process
can’t access to the secure data. This work is a novel concept,    including two Algorithms, Key Scheduling Algorithm (KSA)
which combining the RC4 algorithm and pixel shuffling with        and Pseudo Random Generation Algorithm (PRGA) to
H-LSB for grayscale image to improve security and                 produce the keystream of the stream cipher[8].
privacy[1], [5]. The method effective quality is for the
following reasons.                                                Algorithm 1.Key Scheduling Algorithm (KSA).
(i) The simplicity of RC4 and pixel shuffling algorithm
(ii) RC4 requires only byte-length manipulations so it is         INPUT: K[ , ,…. ],m
     suitable for embedded systems,                               OUTPUTS: S
(iii) Even though RC4 has vulnerabilities, we combined it with       1. S[i]=i, for i=0,1,2,…,255
     shuffling to make it almost impossible to break                 2. j     0
(iv) In pixel shuffling all features of an image remain
                                                                     3. For i      0 to 255
  unchanged during the process of encryption and decryption.
v) HLSB use hash function to select insertion LSB bits, so is            3.1 j    (j+S[i]+K[i mod L]) mod 256
     more efficient than simple LSB                                  4. Swap S[i] with S[j]
The following diagrams in fig.1 describe the method of               5. Return (s)
proposed system.
                                                                  Algorithm 2.Pseudo-Random Generation Algorithm (PRGA).
                                                                  INPUT: State S
                                                                  OUTPUT: Key sequence Kseq
                                                                      1. j     0
                                                                      2. i     0
                                                                      3. While not end of sequence
                                                                          3.1. i (i+1) mod 256
                                                                          3.2. j (j+S[i]) mod 256
                                                                          3.3. Swap S[i] with S[j]
                                                                          3.4. Kseq S[(S[i]+ S[j]) mod 256]
                                                                      4. Return (Kseq)
                                                                                                             KSA &
                                                                                                             PRGA
                                                                                    Fig.2.RC4 encryption algorithm
             Fig.1.Proposed system encoder and decoder
                                                                   87
      Annual Conference on New Trends in Information & Communications Technology Applications-(NTICT'2017)
                                                          7 - 9 March 2017
                                                                     x=1, 2 and 4 bits of green pixels,
                                                                     x=3 and 4 bits of blue pixels.
B. Image pixel shuffling technique
   A technique of shuffling of the image pixel values has
proven to be really effective in terms of the security analysis.
The extra swapping of pixels in the image file after component
shifting has increased the security of the image against all
possible attacks available currently [1].
   This paper manages a basic image encryption method using
adjustment or rearranging of the image pixels. Initially we
take a grayscale image of size N × N. In the straightforward
mentation we took a 256 × 256 grayscale image and
rearranged pixels in an arbitrary way and this random order                         Fig.4. Distribution of Secret Message bits
used as the common key between the parties. Pixel shuffling
                                                                     To recognize the placements to conceal information in LSB of
consists of a permutation map that is applied to decrease
                                                                     each RGB pixels of the cover image the following formula can
adjacent pixels correlation. From the rearranged framework
                                                                     be used:
the scrambled image is as appeared in fig.3.
                                                                                           P= H L                             (1)
The result of grayscale image (256 x 256) shuffling is as
shown below                                                          Where, P is the LSB bit placement inside the pixel,
                                                                     H demonstrate the position of any concealed picture pixels,
                                                                     L is number of bits of LSB which is 4 for the present case.
                                                                     HLSB Inserting proposed algorithm
                                                                     1- Take encrypted image
                                                                     2- Select a cover color image.
                                                                     3- Take 4 LSB bits of every (Red, Green, and Blue) pixels of
                Fig.3. .shuffling encryption algorithm               the cover image.
C. Hash-LSB Techniques                                               4- Embed 8 bits of encrypted image into the 4 LSB in pixels
   Image steganography taking benefit of human eye                   of cover image in the sequence of 3, 3, 2 respectively utilizing
constraint. It utilizes RGB image as the cover image for             the hash function in eq 1.
inserting secret image. The major attribute of a steganographic      HLSB Decoding Process
system is to be less distortive while expanding the extent of        1-Obtain stego-image
the secret image. This system is proposed to hide a grayscale        2- Detect 4 LSB bits of each RGB pixels from stego-image.
secret image into a RGB cover image. A 3,3,2 LSB insertion           3- Implement the hash function to acquire the placement of
method is used for color image steganography [2].                      LSB of used image.
   The hash based LSB technique is different from simple LSB         4- Recover the bits in sequence of 3, 3, and 2 respectively.
technique on basis of hash function as hide eight bits of secret     5- Finally read the secret image.
image in LSB positions of RGB pixels of cover image and the
distribution sequence of bits is 3,3,2 respectively and in such
                                                                                       III. RESULT ANALYSIS
a way that first 3 bits of the 8 bits secret image are inserted
into R pixel and other 3 bits of secret image into G pixels and        Based on the proposed algorithm, we have developed a
remaining 2 bits are inserted into B pixels [9]. These eight bits    system, which implements the proposed algorithms using
are embedded in a specific order based on the chromatic              MATLAB program. As a target measure, the Mean squared
impact of blue color to the human eye is more than red and           Error (MSE), Peak Signal to Noise Ratio (PSNR) and security
green colors [10]. In LSB insertion technique, when the binary       quality (SQ) are studied.
representation of the secret data overwrite in the LSB of every              MSE=
                                                                                =                                                (2)
byte in the cover file the amount of change happened in cover
image will be negligible and not perceived to the human eye             Where, MSE is Mean Square error, H and W are height and
[9].                                                                 width and P(i,j) is original image and S(i,j) is (stego or
The insertion of secret data pixel (8-bit) is in the order (3,3,2)   reconstructed ) image.
as shown in fig (4).The embed position of each pixel(8-bit) of                    PSNR = 10 log10                                 (3)
secret image in the LSB of (red, green, blue) of cover image
is as represented in x, Where x is LSB bit position per pixel          Where, PSNR is peak signal to noise ratio, L is signal level
                                                                      for a used image it is taken as 255.
x=1 ,2 and 3 bits of red pixels,
                                                                     88
     Annual Conference on New Trends in Information & Communications Technology Applications-(NTICT'2017)
                                                                 7 - 9 March 2017
                 SQ=  =                                 (4)               In Histogram Analysis, The statistical features of images are
 Where SQ is security quality, X Is the original image                    presented using histogram that plots the occurrences frequency
 histogram and X’ is scrambled/encrypted image histogram.                 of image pixel value, this analysis is done to compare original
                                                                          and encrypted images where there should be no similarities
                                                                          between original image and encrypted image histograms.
A. In sender side
1. Reading the grayscale secret image and RGB cover image, the
following images will be used.
                              Secret images
             1                       2                       3
                            RGB cover image
                                                                                            Fig.8. Histogram analysis of secret images
                                                                             In above all images shows that the cover image and stego-
                                                                          image does not change, fig.6. Demonstrates the cover image
                                                                          object while applying the Shuffling and RC4 with HASH LSB
                                                                          technique.
                 1                   2                   3                   We can embed the secured secret image into that cover
                     Fig.5.Secret and RGB cover images                    image. When we can compared cover image and stego-images
                                                                          we can realize that both images are same.
2. Encrypt secret image sing RC4 and pixel shuffling
                                                                          So it is clear that we can embed the image, file or message in
3- Embed 8 bits of encrypted image into 4 bits of LSB of RGB
                                                                          to the cover image by using Image Steganography method for
pixels in the sequence of 3, 3, and 2 respectively                        more security and authentication.
                                                                          In this section, both peak signal to noise ratio, mean square
                                                                          error and security quality are calculated for proposed system.
                                                                          The measures is shown in table 1 for secret images and table 2
                                                                          for cover images
                                                                             The results that are obtained from the two objective tests
                                                                          prove that the coded system is more secure than uncoded
                                                                          system since the values approaches one for secret images and
                                                                          for stego-images with high PSNR values. This means that high
                                                                          level of the similarity exists between the stego-images and
                                                                          cover images and the same is for secret images and extracted
                                                                          ones.
                                                                                    Table I.MSE, PSNR, SQ and Elapsed time for secret images
                                                                                                                             Security
                                                                                Images         MSE           PSNR                              Time
                                                                                                                              quality
                                                                                secret 1         0          infinity             0             709 s
                       Fig.6.Image Encryption phase
                                                                                secret 2         0          infinity             0             7.17 s
                                                                                secret 3         0          infinity             0             7.07 s
B. In receiver side
                                                                                     Table II.MSE, PSNR and Elapsed time for cover images
                                                                                Images              MSE                  PSNR               Time
                                                                                cover 1            0.0305               63.2944             7.09 s
                                                                                cover 2            0.0306               63.2746             7.17 s
                                                                                cover 3            0.0313               63.1807             7.07 s
                       Fig.7. Image Decryption phase
                                                                           89
      Annual Conference on New Trends in Information & Communications Technology Applications-(NTICT'2017)
                                                          7 - 9 March 2017
                     IV. CONCLUSION                                  [5] N. G. A. P. H. Saptarini, Y. A. Sir, “Digital Color Image
In this paper, a cryptography and steganography algorithms               Encryption Using RC4 Stream Cipher and Chaotic
proposed to increase security and authentication of data                 Logistic Map”, Information Systems International
transmitted in a network environment. The proposed system is             Conference ,December, pp. 2–4, December 2013.
one of the best ways of hiding the secret of data transferred        [6] http://en.wikipedia.org/wiki/RC4 accessed at 25 January
between sender and receiver from intruders in unsecured                  2013.
networks. The Cryptography techniques RC4 & Shuffling                [7] A. Mousa and A. Hamad, “Evaluation of the RC4
cipher algorithm has been implemented to encrypt the secret              Algorithm for Data Encryption,” no. 1, pp. 44–56, June
image(jpg, png, gif, bmp) before embedding it in the RGB                 2006.
cover image(jpg, png, gif, bmp) with the goal that it is difficult   [8] B. H. Kamble, “Robustness of RC4 against Differential
to intruder to detect the encryption. Image encryption using             attack” ,International Journal of computer science and
RC4 and Shuffling encryption has a considerable security                 application, vol. 1, no. 4, pp. 661–665, June 2012.
quality factor which implies the intensity distributions for the     [9] A. M. Abdullah, “New Approaches to Encrypt and
original images and mutilated image are distinctive. When we             Decrypt Data in Image using Cryptography and
consider the encrypted image histogram we notice that they               Steganography Algorithm”, International Journal of
have a uniform distribution. The Hash based Least Significant            Computer Applications, vol. 143, no. 4, pp. 11–17, June
Bit (H-LSB) steganography has been implemented for                       2016.
embedding encrypt image into cover image. The proposed               [10] P. R. Deshmukh and B. Rahangdale, “Hash Based Least
HLSB technique is the development of an enhanced                         Significant Bit Technique For Video Steganography”, Int.
steganography by concealing data in an image with less                   Journal of Engineering Research and Applications, vol. 4,
variety in image bits have been made which makes proposed                no. 1, pp. 44–49, January 2014.
algorithm secure & more effective and can have the
authentication module beeline with encryption techniques.
To evaluate this system we tested a number of images to be
encrypted and hidden with the proposed algorithms.
According to the tested we found that the system has provide
a high security and easy way to encrypt, embedding and
decrypt secret image without effecting the quality of
images(secret or cover) as appeared in measurements of (MSE
, PSNR and security quality) . Hence this system is very
efficient to hide grayscale image inside other RGB image and
can be developed to hide color image in other color image as
future consideration.
                          REFERENCES
[1] Q. Kester, “A cryptographic Image Encryption technique
    based on the RGB PIXEL shuffling A cryptographic Image
    Encryption technique based on the RGB PIXEL shuffling”,
    International Journal of Advanced Research in Computer
    Engineering & Technology, vol. 2,no.2 pp.848-854,
    January 2013.
[2] P. Sahute, S. Waghamare, S. Patil, and A. Diwate, “ Secure
    Messaging Using Image Stegnography”, International
    Journal of Modern Trends in Engineering and
    Research,vol.2,no.3, pp. 598–608, March 2015.
[3] N. Agarwal and P. Agarwal, “An Efficient Shuffling
    Technique on RGB Pixels for Image Encryption”, MIT
    International Journal of Computer Science & Information
    Technology, vol. 3, no. 2, pp. 77–81, August 2013.
[4] K. Hamdnaalla, A. Wahaballa, and O. Wahballa, “Digital
    Image      Confidentiality     Depends    upon      Arnold
    Transformation and RC4 Algorithms”,International
    Journal of Video & Image Processing and Network
    Security, vol.13, no. 04,August 2013.
                                                                     90