You are on page 1of 6

2018 3rd IEEE International Conference on Recent Trends in Electronics, Information & Communication Technology (RTEICT-2018), MAY 18th

& 19th 2018

Image Encryption using SCAN Patterns & Hill Cipher


V PRAVEENA P HARI MANOHARA VARMA BVSSN RAJU
M.Tech Student, Dept. of ECE, M.Tech Student, Dept. of ECE, Professor, Dept. of ECE,
SRKR Engineering college, SRKR Engineering College, SRKR Engineering College,
Bhimavaram, India Bhimavaram, India Bhimavaram, India,
vardhanapushiny@gmail.com harivarmapenmethsa@gmail.com dcraju123@gmail.com

Abstract— Encryption can be done in many ways for transport encryption. It intricately replaces the mapping of image with a
of image, data, video and audio over wireless networks. A new sequence of scan patterns randomly chosen from SCAN
technique for image encryption is proposed in this paper. The library by a key. A Modified Hill encryption and decryption
method uses a combination of SCAN patterns, carrier image and technique for images has been proposed in [6-7] which uses an
Hill-cipher technique. This ensures more security for the image.
involuntary random key matrix [6-7]. S.R.M. Prasanna, Y.V.
The SCAN is a language based spatial accessing methodology
generating a wide range of scanning paths. The carrier image is SubbaRao and A. Mitra [1] have presented a method for image
created with the help of an ASCII string. The obtained carrier encryption which involves known methods for magnitude and
image together with the payload is encrypted with SCAN patterns phase encryptions using carrier images. The methodology is
and XOR operation is performed between them. Then Hill-cipher done on grayscale images, by dividing the image into its
technique is applied for the resultant image to obtain the final corresponding bit planes. Encryption is done by using a scan
encrypted image. Applying reverse operation to the encryption path which is kept in secret. Chao-Shen Chen, and Rong-Jian
process, the decrypted images are retrieved. Chen have also presented an image encryption and decryption
process which is based on scanning patterns [2-5]. This image
Keywords—SCAN Patterns, Carrier, ASCII keywords, Hill-
cipher, Encryption and Decryption.
encryption method is based on the rearrangement of the pixels
of the image. The rearrangement is done by scan patterns that
are generated by the SCAN methodology.
I. INTRODUCTION
The confidentiality & security of sensitive With an aim to increase the key space of the
communication is one of the main concerns of cryptography. algorithm the concepts of SCAN patterns & Hill cipher are
Encryption is a process of restructuring the data into some combined in this work. The main objective of the proposed
unknown form controlled by a known random key to ensure algorithm is to encrypt an image using a technique different
privacy by keeping the message hidden from anyone for whom from the traditional permutation based pixel scrambling
it is not intended. Encryption and decryption techniques schemes.
usually require some secret message, referred to as a key to
enable authentication. Decryption is the reverse process of The organization of the paper is as follows:
encryption. The encryption process may use different keys for Following the introduction, the basic concept of SCAN
encryption and decryption. The message recipient creates a patterns, a method of generating carrier key and the Hill-cipher
private key and a public key. The public key is distributed are discussed in section II. Section III presents the proposed
among the message senders and they use the public key to method of image encryption by combining SCAN patterns and
encrypt the message. The unencrypted data is referred to as the Hill-Cipher algorithm. In section IV experimental results are
plaintext and the encrypted data as cipher text. The security of given. Finally, section V gives some conclusions.
encryption lies in the ability of an algorithm to generate cipher
text that is not easily reverted to the original plaintext. One can I. IMPLEMENTATION STEPS
use a two dimensional polygraphic substitution cipher such as
Hill cipher which increases the level of security. Hill cipher A. SCAN Patterns
uses Linear Matrix Algebra & Modular Arithmetic to encrypt The SCAN is a formal language-based two
and decrypt the information. A cipher key is the information dimensional spatial accessing methodology which can
that allows only those that hold it to encode and decode a represent and generate a large number of wide varieties of
message. Keys come in many different forms such as scanning paths. SCAN language uses four basic scan patterns.
passwords, numbers generated by an algorithm, digital They are continuous raster C, continuous diagonal D,
fingerprints and even electronic devices. A key allows both the continuous orthogonal O, spiral S, Right orthogonal A,
sender and the recipient of the message to understand how the diagonal parallel E, vertical symmetry S, continuous
message has been encrypted and assures them that nobody else orthogonal L, zeta Z, block Band raster R.
knows how it has been encrypted. Coming to the traditional
image encryption in non-transform domain it basically
involves the matrix based pixel location and/or pixel value
affine transformations causing histogram reshaping. One can
also use complex scan pattern based permutations for image

978-1-5386-2440-1/18/$31.00 ©2018 IEEE


1983

Authorized licensed use limited to: Nitte Meenakshi Institute of Technology. Downloaded on June 14,2022 at 15:47:45 UTC from IEEE Xplore. Restrictions apply.
A given input image is encrypted by rearranging the pixels of The structure of a scan pattern can be shown in matrix form.
the image using a set of scanning patterns. In this paper we For example, here two scan paths are shown in Fig. 2 below
assume that the maximum image size is 512×512 and the considering the continuous raster C and spiral-in I.
partition size is 8×8 blocks uniformly throughtout. Fig. 1
below depicts some standard scanning paths.
P(1,1) P(1,2) P(1,3) P(1,4) P(1,5) P(1,6) P(1,7) P(1,8)

P(2,1) P(2,2) P(2,3) P(2,4) P(2,5) P(2,6) P(2,7) P(2,8)

P(3,1) P(3,2) P(3,3) P(3,4) P(3,5) P(3,6) P(3,7) P(3,8)

P(4,1) P(4,2) P(4,3) P(4,4) P(4,5) P(4,6) P(4,7) P(4,8)

P(5,1) P(5,2) P(5,3) P(5,4) P(5,5) P(5,6) P(5,7) P(5,8)

P(6,1) P(6,2) P(6,3) P(6,4) P(6,5) P(6,6) P(6,7) P(6,8)

P(7,1) P(7,2) P(7,3) P(7,4) P(7,5) P(7,6) P(7,7) P(7,8)


(a) (b)
P(8,1) P(8,2) P(8,3) P(8,4) P(8,5) P(8,6) P(8,7) P(8,8)

(a)

(c) (d)

(b)

(c)
(e) (f)
Fig. 2: (a) Matrix form of a Scan structure, (b) Matrix form for Continuous
Raster C, and (c) Matrix form for Spiral In.

B. Carrier image
Generally a carrier is used to carry or transfer the secret
message or some image information. The carrier image can be
created by transforming text into an image by using ASCII
codes & 2D repetition. Keywords of size equal to original
image size are formed into a matrix form. Here, a carrier
image is generated with the help of a key “ECE Dept., SRKR
Engg College, Bhimavaram”, as password and is shown
below in Fig. 3. Once a carrier image is created it can be used
(g) (h) in the encryption process by XOR operations.

Fig. 1: Different Scan Patterns (a) Spiral-In (b) Zeta-Z (c) Block-B (d) Raster-
R (e) Right Orthogonal-A (f) Diagonal-D (g) Continuous Raster-C (h)
Diagonal parallel-E

1984

Authorized licensed use limited to: Nitte Meenakshi Institute of Technology. Downloaded on June 14,2022 at 15:47:45 UTC from IEEE Xplore. Restrictions apply.
orthogonal L, zeta Z, block B, raster R and their combination.
These patterns are taken as first key-P.

Fig. 3: Carrier image created from textual password

C. Hill cipher
The Hill cihper is a modular matrix multiplication
operation. It is a multi-symbol cipher, developed by the
mathematician Lester Hill in 1929 for data encyption. In
classical cryptography, the Hill cipher is a polygraphic
substitution cipher based on linear algebra. For text
encryption, the algorithm takes m-suceessive plain text
charcters represented by a vector R of numerical values. The
Hill cipher key M is a m*m matrix, and the cipher text block S
is given by, S MR mod128 . On the decryption side, a
modular inverse of key matrix M 1 is used. M and M-1 satisfy Fig. 4. Block diagram for the proposed scheme for Image Encryption using
Carrier image, SCAN patterns and
MM 1 M 1M I . For a 8-bit image encryption, we Hill-Cipher
partition the image into non-overlapping blocks R of equal size
M*M and use a key matrix M of size 4*4 with elements The Carrier image uses a second password key-R. The
chosen from {0, 1, 2, …, 255}. Thus R becomes an image carrier image is created with the help of ASCII values of mod-
block of size 4*4 of pixel values. Calculating this solution by 128 and is further encrypted by using another SCAN sequence
standard linear algebra algorithms takes a very little time. The controlled by a third key-Q. The resulting images from the
key size is the binary logarithm the number of possible keys. above steps are XOR'ed together to form an image to which
n2 Hill-cipher operation is applied which uses another & final
For 8-bit images there are 256 matrices of dimension n × n fourth key-M to get the final hill-Cipher encrypted image. For
creating a huge key space. The main equations depicting decryption all the above encryption steps are reversed
encryption and decryption are sequentially to get the original Einstein image. More number
of keys will produce higher security to the encrypted image.

S MR mod 256 and


III. IMPLEMENTATION RESULTS
1
R M S (mod 256)
Implementation of the above method is carried out on
MATLAB software. The encryption results are obtained for
II. PROPOSED METHOD different SCAN patterns with XOR operation of carrier image
and combined with cell encryption using 4-by-4 Hill cipher.
In this paper a new encryption scheme is proposed as shown The results are shown in Fig. 5 below. The image histograms
in Fig. 4 with higher security by adding some more processing for the input image, SCAN encrypted, XOR encrypted and
levels. The methodology is described as follows; the original Hill-Cipher encrypted images are also shown in Fig. 6.
image i.e., Einstein img.bmp is cell encrypted first with a
random permutation of image blocks, then scan encryption is
done with a randomly chosen complex chain of scan patterns.
These are continuous raster C, continuous diagonal D,
continuous orthogonal O, and spiral S, Right orthogonal A,
diagonal parallel E, vertical symmetry S, continuous

1985

Authorized licensed use limited to: Nitte Meenakshi Institute of Technology. Downloaded on June 14,2022 at 15:47:45 UTC from IEEE Xplore. Restrictions apply.
(a) Original image (b) Cell & Scan encrypted image
(c) Histogram after XOR (d) Histogram after Hill-Cipher Encryption

Fig. 6: Image Histograms from the image encryption of Einstein

A. MSE and PSNR


For calculating the image quality, there are two important
image quality metrics namely, peak signal to noise ratio
(PSNR) and Mean square Error (MSE). The MSE and PSNR
can be computed by using the equations given below. The MSE
value gives the square of the error between the original and the
encrypted images and is tabulated in Table-1.
(c) SCAN Encrypted Carrier (d) SCAN encrypted image after XOR
ª r2 º
PSNR 10 log10 « »
¬ MSE ¼
2

MSE
1 M N
>
¦ ¦ Corg (P1, P2)  Cenc (P1, P2)
MN P1 1 P 2 1
@

B. NPCR and UACI


Two other metrics are used to measure the changes in the
image due to encryption. They are Number of pixels change
rate (NPCR) and (UACI) unified average changing Intensity
(e) Hill-Cipher encrypted image computed using
Fig. 5: Results from the image encryption of Einstein

¦ S p, q
p ,q
NPCR u100 ,
R
where

°0 Corg p, q Cenc ( p, q)
­
S k, l ® ,
°̄1 Corg p , q z Cenc ( p , q )
and

ª
c p, q  c p, q º» u100 .
(a) Histogram of the original image (b) Histogram after SCAN
1 «
¦
org enc
UACI
M « p ,q 255 »
¬ ¼

1986

Authorized licensed use limited to: Nitte Meenakshi Institute of Technology. Downloaded on June 14,2022 at 15:47:45 UTC from IEEE Xplore. Restrictions apply.
C. ENTROPY & Correlation
Different
Entropy is used to calculate the disorder in any image. Scan MSE/
Correlation:
Correlation is used to calculate the quality of the encryption Vertical
patterns PSNR NPCR UACI Entropy
algorithm. The correlation coefficient is used to compute the Horizontal
for image
correlation between two vertical and two horizontal and two Diagonal
EINSTEIN
diagonally adjacent pixels of cipher image. The expressions for
1.3814*104
entropy, covariance and correlation coefficient are reproduced Continuous 101.8721 99.6090 10.6064 7.6727
7.9655*104
below. The values of Horizontal, Vertical, and Diagonal raster C 28.0502
2.0911*104
correlation for encrypted image are also listed in the Table-1.
0.0028
The horizontal, vertical and diagonal correlations for the BlockB 101.7249 99.6162 10.5959 7.6721 2.5731*104
original image are shown in Fig. 7. Similarly Figs. 8, Fig.9, and Raster C 28.0565 8.5602*104
Fig. 10 depict the horizontal, vertical and diagonal correlations
for the SCAN encrypted, XOR operated, and the final Hill- 0.0045
Zeta Z 101.9144 99.6235 10.6155 7.6716 2.3415*104
cipher encrypted images respectively. Raster R 28.0484 0.0050*104
L 1
Entropy ¦ p log
i 0
i 2 pi

cov u, v E u  E u v  E v

Cov(u, v)
ruv
var(u ) var(v)

TABLE-I. VALUES OF MSE/PSNR, NPCR, UACI, ENTROPY,


HORIZONTAL, VERTICAL AND DIAGONAL CORRELATIONS IN
ENCRYPTION

Different
Correlation:
Scan MSE/
Vertical
patterns PSNR NPCR UACI Entropy
Horizontal
for image
Diagonal
EINSTEIN
4.5210*104
Spiral in I 101.8094 99.6212 10.6473 7.6811 0.0021
28.0529 0.0025 Fig.7. Correlations for Original image

Zeta Z 102.0065 99.5956 10.5723 7.6124 8.8683*104


20.0445 00023
3.8829*104
0.0011
Block B 101.9681 99.6025 10.6451 7.6730 0.0019
28.0462 0.0026

0.0041
Raster R 101.5863 99.6170 10.6091 7.6723 2.3404*104
28.0625 0.0015

0.0023
Vertical 101.4980 99.6113 10.6560 7.3256
symmetry 28.0401 6.8478*104
0.0025
S

Right 101.9275 99.6201 10.6474 7.6724 8.9012*104


Orthogonal 28.0479 9.2932*104
A 6.2556*104

Continuous 101.7053 995872 10.6152 7.6720 4.1974*10 4


2.435*10 4 Fig.8. Plot of Correlations for SCAN encrypted image
Orthogonal 28.0574
L 8.7612*10 4
0.0021
ZigZag D 101.7818 99.6040 10.6052 7.6823 0.002
28.0541 8.4121*104

1987

Authorized licensed use limited to: Nitte Meenakshi Institute of Technology. Downloaded on June 14,2022 at 15:47:45 UTC from IEEE Xplore. Restrictions apply.
REFERENCES

[1] S.R.M Prasanna, Y.V. Subba Rao and A. Mitra, “An Image Encryption
method with Magnitude and Phase Manipulation using carrier images,”
IJCS, vol. 1, No 2, pp.132-137, 2006.
[2] N.Bourbakis, “Image data compression encryption using G-SCAN
patterns,” IEEE conference on SMC, October 1997, pp.1117-1120.
[3] Shalin J Patel, “Image Encryption and Compression using Scan Pattern,”
IJSRD - International Journal for Scientific Research & Development
Vol. 3, Issue 03, 2015 | ISSN (online): 2321-0613
[4] Chao Shen Chen and Rong Jian Chen, “Image encryption and decryption
using SCAN methodology,” Proc. PDCAT, 2006.
[5] S.S. Maniccam and N.G. Bourbakis, “Image and video encryption using
SCAN patterns,” Pattern Recognition, vol. 37, pp. 725-737, 2004.
[6] Sinha, K. Sing, “A technique for image encryption using digital
signature,” Optics Communication, 218, pp.229-234, 2003.
[7] S.S. Maniccam, N.G. Bourbakis “Lossless image compression and
encryption using SCAN,” 0031-3203/$2000,2001.
[8] Prerna, Urooj, Meena kumari, Jitendra Nath shrivastava, “Image
Fig. 9. Plot of correlations after XOR Operation Encryption and Decryption using Modified Hill Cipher Technique,”
ISSN 0974-2239 Volume 4, Number 17 (2014), pp. 1895-1901

Fig. 10. Correlations for Hill-cipher Encrypted image

V CONCLUSIONS AND FUTHER SCOPE


In this paper, a new approach for image encryption
using a combination of Scan patterns and Hill-Cipher
technique is proposed. The effectiveness of the method has
been verified by simulation experiments. The results show that
the cipher image has an entropy value close to the ideal value
eight (08), and also has very low pixel correlation coefficients.
The analysis shows that the proposed image encryption
technique method has a very huge key space, compared to
other methods, generated by the Scan patterns library & Hill
matrices, thus offering enhanced security. This work can be
extended further by considering the joint compression &
encryption simultaneously, and also modified Hill-cipher can
be employed for greater security improvement.

1988

Authorized licensed use limited to: Nitte Meenakshi Institute of Technology. Downloaded on June 14,2022 at 15:47:45 UTC from IEEE Xplore. Restrictions apply.

You might also like