1 Introduction

The need for the distribution of the digital images over networks has become a crucial part of everyday life. Moreover security is becoming an important apprehension in an increasingly multimedia defined world [15]. Hence, in order to maintain the privacy or security, sensitive data needs to be protected before transmission or storage. And, encryption is one of the ways to protect the information, which is a process of disguising a message to hide its substance.

Many traditional ciphers such as the DES, AES, GOST, BLOWFISH etc. were proposed as secure measures. But, due to the bulk volume of data and high correlation among the adjacent image pixels, traditional methods cannot suit for the image encryption. Moreover, it is computationally expensive if we use directly these traditional ciphers to encrypt image data [110].

In recent years, extensive studies have been done in the field of chaotic cryptography. The chaotic systems are characterized by ergodicity, random-like behaviors and sensitive dependence on initial values and parameters. These properties are of immense importance in cryptographic confusion and diffusion processes [510]. Hence chaotic based encryption is receiving increasing interest from cryptographers.

Over the past decade, a number of chaotic based image encryption schemes have been proposed, however, each of the image encryption schemes in the literature have their own strengths and constraints in terms of security and performance [1, 2]. This paper proposes a new image encryption scheme based on a Peter De Jong chaotic map and a RC4 stream cipher. The proposed encryption scheme is computationally fast over other schemes and is resistant to a variety of cryptanalytic attacks such as the brute-force attacks, statistical attacks, differential attacks and entropy based attacks.

The novelty of this paper is listed below.

  1. (i)

    The Peter de Jong chaotic map and RC4 stream ciphers are explored together for image encryption.

  2. (ii)

    Key generation and scheming is carried in an innovative way by initializing the RC4 with chaotic values.

  3. (iii)

    The encryption operations are carried with new methods.

  4. (iv)

    The proposed scheme is computationally fast with security intact.

The remaining of this paper is structured as follows. In Sect. 2, the literature survey is presented. The Peter De Jong chaotic map and RC4 stream ciphers are discussed in Sect. 3. The proposed encryption scheme is described in Sect. 4. Experimental findings and the security analysis are shown in Sect. 5 to illustrate the effectiveness and validity of the proposed scheme. Final section concludes the paper.

2 Literature Survey

Typically, a chaotic based image encryption scheme consists of two stages: permutation and diffusion [16]. The adjacent pixels are decorrelated by employing the permutation and spreading the effect of the individual pixels across the entire image is achieved by using diffusion. A brief literature survey is presented hereafter.

The authors of [1], proposed a digital image encryption scheme, by employing multiple 1D chaotic map and the cryptographic primitive operations. The chaotic maps used are: logistic map, cubic map, sin map and tent map. The algorithm consists of three components: Key expansion, encryption and decryption. The scheme encrypts 256-bit of the plain image to 256-bit of the cipher image within eight 32-bit registers. The encryption scheme consists of eight w-bit registers R i (i = 1, 2, …, 8), which contain the initial input plain image as well as the output cipher image at the end of the encryption process. The encryption is performed by using a xor and pixel value circular rotations. In [2], an encryption scheme based on coupling of chaotic maps and a xor operator is presented. The method disturbs the inner binary structure of the image and progressively brings the randomness characteristics. The encryption process is straightly realized on the bits of the plain image. The image is shuffled by using a chaotic function based on linear congruence. The authors of [3] employed multiple chaotic maps to increase the key space to resist the brute force attacks. Nidhi Taneja [4], proposed a structure of combinational domain encryption that encrypts important data in spatial domain and the irrelevant data in wavelet domain. The proposed technique considers the varying data significance and support dissimilar security level to regions of different significance. The scheme makes use of Prewitt edge detector, discrete wavelet transform, Arnold cat map and logistic map.

In [5], an image encryption scheme based on an intertwining chaotic map is proposed to increase the keys pace and security. The substitution process uses six arbitrarily chosen odd integers to permute and then xored with the first chaotic key to shuffle and change the image pixel values. The diffusion stage alters the pixel values successively with various operations which include non linear diffusion using the first chaotic value, subdiagonal diffusion of the neighboring pixels and xoring with the third chaotic value. The authors of [6], proposed an image encryption scheme based on chaos and multiple S-boxes. A chaotic map is employed to determine the values of S-boxes. The encryption operations are based on the contents of S-boxes. The authors of [7], proposed a parametric switching chaotic system and its corresponding transforms for image encryption. The scheme integrates the logistic, sin and tent maps into one single system. In [8], an image encryption scheme based on a generalized Arnold cat map is presented. The typical permutation diffusion architecture is employed. Two generalized Arnold cat maps are utilized to generate the chaotic sequences. The scheme has three parts: circular permutation, positive diffusion and opposite diffusion. In [9], an image encryption scheme based on cyclic elliptic curve and a chaotic system is presented. The round keys are generated based on piecewise nonlinear chaotic map. In [10], an image encryption scheme based on Chua chaotic system is presented. The operations are based on indexing and shuffling of the rows and columns. In [11], an image encryption algorithm based on chaos map together with pixel bit is presented. The scheme can implement the position encryption and gray value encryption simultaneously. The authors of [12], proposed an image encryption scheme by using a large pseudorandom permutation which is combinatorially generated from small permutation matrices based on chaotic maps. In [13], discrete exponential chaotic map is explored for image encryption. The permutation is carried with an S-box. In [14], a chaotic block cipher for wireless sensor network is presented and demonstrated better performance over RC5 and RC6 block ciphers. The details of the RC4 are provided in [15].

Though, there exist several image encryption schemes in the literature, each of them have their own strengths and limitations more or less in terms of security level and computational performance. Majority of the schemes produce satisfactory security results but lack in the computational speed. This paper proposes a new image encryption scheme based on a Peter De Jong chaotic map and a RC4 stream cipher. The proposed encryption scheme attains the required level of security with only two rounds and is computationally fast over other schemes in the literature. Moreover, the proposed approach is resistant to a range of cryptanalytic attacks such as the brute-force attacks, statistical attacks, differential attacks and entropy based attacks.

3 Pseudo Random Number Generators

The proposed encryption scheme utilizes a Peter De Jong chaotic map and a RC4 stream cipher for the pseudo random number generation these are discussed hereafter.

3.1 Peter De Jong Chaotic Map

The 2D Peter De Jong map is a discrete-time dynamical system and is defined as,

$$ X_{i + 1} = \sin \left( {aY_{i} } \right) - \cos \left( {bX_{i} } \right) $$
(1)
$$ Y_{i + 1} = \sin \left( {cX_{i + 1} } \right) - \cos \left( {dY_{i} } \right) $$
(2)

where X i , Y i are the current chaotic values, \( X_{i + 1} ,Y_{i + 1} \) are the next chaotic values and a, b, c, d are the control parameters. The key set for the Peter De Jong map is {X 0Y 0abcd}. In the proposed scheme, the Peter De Jong chaotic values are used to determine the initial key values for the RC4 stream generator and also during the permutation.

The chaotic output sequence of the Peter De Jong map is assessed by computing the mean and self-correlations. It is observed that the average value of the chaotic sequence is close to 0.5 and the self correlations within the sequence and across the two sequences are very close to 0.

3.2 RC4 Stream Generator

The RC4 stream cipher is employed to generate the pseudo random numbers for the pixel value rotation and diffusion operations and is summarized beneath.

RC4 is a variable key-size stream cipher with byte oriented operations [15]. The algorithm is based on the use of the random permutation. Analysis show that the period of the cipher is likely to be greater than 10100 and the cipher run very quickly in software.

The RC4 algorithm is amazingly simple. A variable length key of from 1 to 256 bytes is used to initialize a 256 byte state vector S with elements S[0], S[1], …, S[255]. At all times, S contains a permutation of all 8-bit numbers from 0 through 255. For encryption operations a byte K is generated from S by selecting one of the 255 entries in a systematic fashion. As each value of K is generated, the entries in S are once again permuted.

Initiation of RC4 stream generation requires a key of length keylen bytes. Key is an array of length keylen. The keylen is variable and it varies from 1 to 256 bytes. A value of 256 is chosen as keylen in the proposed scheme hence there is no effect of mod operation. Following is the pseudo code for the RC4 stream generation.

4 Proposed Encryption Scheme

The proposed encryption scheme is comprised of a round key generation function and three encryption stages: (i) permutation (ii) pixel value rotation and (iii) diffusion. The architecture of the proposed encryption scheme is shown in Fig. 1 and discussed hereafter.

Fig. 1
figure 1

Architecture of the proposed encryption scheme

4.1 Round Key Generation and Scheming

In the proposed scheme, the key length of the RC4 stream cipher is chosen as 256 bytes. Hence at each encryption round it requires 256 pseudo random bytes as key, and are generated by employing a Peter De Jong map.

The key set of the Peter De Jong map is {X 0Y 0abcd} and which initiates the RC4 stream generation. Hence the key set of the proposed encryption/decryption process is,

$$ Key\;set = \left\{ {X_{0} ,Y_{0} ,a,b,c,d} \right\} $$
(3)

where {X 0Y 0} are the initial values of the chaotic system and {abcd} are the system parameters.

The generated chaotic sequence is a real sequence and is transformed to the integer form with the following transform.

$$ T^{\prime}_{i} = \left( { T_{i} \; \times \;10^{8} } \right) mod\, m $$
(4)

where T i is the real chaotic value, \( T^{\prime}_{{_{i} }} \) is the transformed integer value and m is 256 for the gray level image.

The Peter De Jong map is a 2D map and it generate two chaotic sequences X, Y and the following is the key scheming approach employed in the proposed scheme

Step 1:

Generate 128 Peter De Jong chaotic values {X and Y sequence}

Step 2:

Transform the real values to the integer form

Step 3:

Assign X sequence to Key[0], …, Key[127], and Y sequence to Key[128], …, Key[255]

where XY are the Peter De Jong chaotic values and Key[0, …, 255] is the initial key for the RC4 stream generator.

The above process is repeated for each round, and two rounds of the encrypt function provide the sufficient security.

Key scheming is shown beneath.

$$ \begin{aligned} &Round 1 { }: \hfill \\ &\;\;\;\;\;\;\;\;\;\;Key\left[ {0.. 2 5 5} \right] = \left\{ {X\left[ 0 \right],..,X\left[ { 1 2 7} \right],Y\left[ 0 \right],..,Y\left[ { 1 2 7} \right]} \right\} \hfill \\ &Round 2 { }: \hfill \\ &\;\;\;\;\;\;\;\;\;Key\left[ {0.. 2 5 5} \right] = \left\{ {X\left[ { 1 2 8} \right],..,X\left[ { 2 5 5} \right],Y\left[ { 1 2 8} \right],..,Y\left[ { 2 5 5} \right]} \right\} \hfill \\ &Round 3 { }: \hfill \\ &\;\;\;\;\;\;\;\;\;Key\left[ {0.. 2 5 5} \right] = \left\{ {X\left[ { 2 5 6} \right],..,X\left[ { 3 8 3} \right],Y\left[ { 2 5 6} \right],..,Y\left[ { 3 8 3} \right]} \right\} \hfill \\ &and \, so \, on.. \hfill \\ \end{aligned} $$
(5)

4.2 Permutation

The permutation is employed to decorrelate the adjacent pixels of an image. Let I be an original gray image with M rows and N columns and the gray intensities lie in the range 0 to 255. In the process of permutation, firstly, M + N Peter De Jong chaotic values {(X 1 ,…,X M ), (Y 1 ,…,Y N )} are generated by using Eqs. (1, 2). Let PM = {X 1 ,…,X M } and PN = {Y 1 ,…,Y N }. Subsequently, PM and PN are sorted, and the positions of the sorted chaotic values in the original chaotic sequence are found and are stored in PM′ and PN′. The permutation stage is comprised of the following four steps

Step 1:

Scramble all the rows according to \( PM^{\prime}_{1} , \ldots ,PM^{\prime}_{M} \)

Step 2:

Scramble all the columns according to \( PN^{\prime}_{1} , \ldots ,PN^{\prime}_{N} \)

Step 3:

Circularly rotate each and every row in alternate orientations and the amount of rotation is based on \( PM^{\prime}_{1} , \ldots ,PM^{\prime}_{M} \). The first row is rotated by \( PM^{\prime}_{1} \), the second row is rotated by \( PM^{\prime}_{2} \), and so on

Step 4:

Circularly rotate each and every column in alternate orientations and the amount of rotation is based on \( PN^{\prime}_{1} , \ldots ,PN^{\prime}_{N} \)

Permutation is exemplified below for an 4 × 4 image.

Step 1:

Generate 4 + 4 chaotic values by using a Peter De Jong map. The first 4 values are used for the row permutation and the next 4 values for the column permutation

Step 2:

Suppose if the first 4 values are

PM = X 1 ,…,X 4 = 0.8,0.7,0.2,0.5

Step 3:

Sort the values.

0.2,0.5,0.7,0.8

Step 4:

Find the position of the sorted chaotic values in the original chaotic sequence.

PM′ = 3,4,2,1

Step 5:

Scramble all the rows based on PM′ i.e.,

1st row elements are moved to 3rd row

2nd row elements are moved to 4th row

3rd row elements are moved to 2nd row

4th row elements are moved to 1st row

Step 6:

Similarly scramble all the columns by using PN

Step 7:

Circularly rotate each and every row in alternate orientations by using PM′ i.e.

Circularly rotate 1st row left 3 times

Circularly rotate 2nd row right 4 times

Circularly rotate 3rd row left 2 times

Circularly rotate 4th row right once

Step 8:

Similarly, circularly rotate all the columns in alternate up and down direction by using PN

The permutation stage involves sorting only M + N values, hence it does not consume more energy.

4.3 Pixel Value Circular Rotations

This stage alters the pixel intensity values by circular rotation and is performed with following steps.

Step 1:

Read the image horizontally and then apply alternate left/right Circular rotation on pixel by pixel basis

Step 2:

Read the image vertically and then apply alternate left/right Circular rotation on pixel by pixel basis

In each of the above two steps, the amount of rotation for the circular rotation is based on M × N RC4 pseudo random numbers, and are computed with following steps.

Step 1:

Generate M × N RC4 pseudo random numbers

Step 2:

Apply mod 8 for all the values, and replace 0 by a number in the range 1 to 7

The above steps generate M × N pseudo random numbers in the range 1 to 7, and are used as the rotation amount for the M × N pixels of the image.

4.4 Diffusion

The diffusion stage is employed to spread the effect of individual pixels over the entire image; i.e., a 1-bit change of the plain image should produce a drastic change in the encrypted image by using the same key. The proposed scheme apply the diffusion twice by scanning the image in two different ways as shown in Fig. 2 and given below.

Fig. 2
figure 2

scanning directions (a) row-wise in alternate orientations (b) column-wise in alternate orientations

Step 1:

Scan the image row-wise in alternate orientations and then apply the forward and backward diffusions

Step 2:

Scan the image column-wise in alternate orientations and then apply the forward and backward diffusions

Each of the above two steps carry out the forward and backward diffusions as discussed below.

At first, the 2D image is converted to 1D array P MN by scanning the image as shown in Fig. 2. Then generate 2(M × N) pseudorandom numbers by utilizing a RC4 stream generator. Assign the first M × N pseudo random numbers to R1 and the next M × N pseudo random numbers to R2. The diffusion operation is performed by using two previously diffused pixels and two RC4 pseudo random numbers as shown in Eqs. (6, 7).

The forward diffusion is realized with the following equation,

$$ E_{i} = \left( {\left( {(((P_{i} + E_{i - 2} } \right)mod\;256 ) + E_{i - 1} )mod\;256 \oplus R1_{i} } \right) + R2_{i} )mod\;256, i = 1,2, \ldots ,MN $$
(6)

where + is the modulo addition, ⊕ is the bitwise XOR, E i is the current pixel to be encrypted, E i−1 and E i−2 are the formerly encrypted pixels, P i is the permuted and rotated pixel, R1 i and R2 i are the RC4 pseudo random numbers. E −1 and E 0 are considered as the constants.

The backward diffusion is accomplished with Eq. (7) to make the effect of every pixel equal

$$ F_{i} = \left( {\left( {(((E_{i} + F_{i + 2} } \right) mod\;256 ) + F_{i + 1} )mod\;256 \oplus R1_{i} } \right) + R2_{i} ) mod\;256, i = MN, \ldots ,1 $$
(7)

where F i is the current pixel to be encrypted, F i+1 and F i+2 are the formerly encrypted pixels, E i is the forward diffused image pixel, R1 i and R2 i are the RC4 pseudo random numbers and E MN+1 and E MN+2 are considered as the constants. Finally, the encrypted image is obtained after these two diffusion steps.

4.5 Decryption

Decryption involves the reconstruction of the original image by following inverse steps. At first, the diffusion is applied then the pixel values are circularly rotated in reverse direction and finally the inverse permutation is applied.

4.6 Encryption Algorithm

The encryption algorithm is comprised of a main routine for the round key generation and an encrypt routine.

4.6.1 Main Routine for the Round Key Generation

Step 1:

Read the original image and store the pixel intensity values in the matrix I M×N

Step 2:

Initialize a Peter De Jong chaotic map {X 0Y 0abcd}

Step 3:

Generate 256 Peter De Jong chaotic values for the RC4 initialization by using Eqs. (1, 2)

Step 4:

Transform the real chaotic values to the integer form and assign to RC4 Key[0, …, 255] as given in Eq. (5)

Step 5:

Generate M + N Peter de Jong chaotic values and assign to PM = (X 1,…,X M ) and PN = (Y 1,…,Y N ) for the permutation by using Eqs. (1, 2)

Step 6:

Invoke the encrypt function

Step 7:

Repeat step 3 through step 7 for the modified image

Note: Two rounds of the encryption provide the sufficient security.

4.6.2 Encrypt Routine

The encrypt routine is comprised of the following steps.

Step 1:

Obtain the image

Step 2:

Sort PM and PN, find the position of the sorted chaotic values in the original chaotic sequence and store in PM′ and PN

Step 3:

Scramble all the rows according to \( PM^{\prime}_{1} , \ldots ,PM^{\prime}_{M} \)

Step 4:

Scramble all the columns according to \( PN^{\prime}_{1} , \ldots ,PN^{\prime}_{N} \)

Step 5:

Circularly rotate each and every row in alternate orientations and the amount of rotation is based on \( PM^{\prime}_{1} , \ldots ,PM^{\prime}_{M} \)

Step 6:

Circularly rotate each and every column in alternate orientations and the amount of rotation is based on \( PN^{\prime}_{1} , \ldots ,PN^{\prime}_{N} \)

Step 7:

Generate M × N RC4 pseudo random numbers for the pixel value rotation

Step 8:

Apply mod 8 for all the values, and replace 0 by a number in the range 1 to 7

Step 9:

Read the image horizontally and then apply alternate left/right circular rotation on pixel by pixel basis

Step 10:

Read the image vertically and then apply alternate left/right circular rotation on pixel by pixel basis

Step 11:

Generate 2 × (M × N) RC4 pseudo random numbers for the diffusion

Step 12:

Scan the image row-wise in alternate orientations and then apply the forward and backward diffusions by using Eqs. (6, 7)

Step 13:

Scan the image column-wise in alternate orientations and then apply the forward and backward diffusions by using Eqs. (6, 7)

4.7 Decryption Algorithm

The decryption algorithm is comprised of a main routine for the round key generation and a decrypt routine.

4.7.1 Main Routine for the Round Key Generation

Step 1:

Read the encrypted image and store the pixel intensity values in the matrix EN M×N

Step 2:

Initialize a Peter De Jong chaotic map {X 0Y 0abcd}

Step 3:

Generate (256 × Number of rounds) Peter De Jong chaotic values for the RC4 initialization by using Eqs. (1, 2)

Step 4:

Generate [(M + N) × Number of rounds] Peter De Jong chaotic values for the inverse permutation by using Eqs. (1, 2)

Step 5:

Transform the real chaotic values to the integer form and assign to RC4 Key[0, …, 255] in the reverse way of their invocations

Step 6:

Assign the real chaotic values to PM = {X 1 ,…,X M } and PN = {Y 1 ,…,Y N } in the reverse way for the inverse permutation

Step 7:

Invoke the decrypt function

Step 8:

Repeat step 5 through step 8 for the modified image

4.7.2 Decrypt Routine

The decrypt routine is comprised of the following steps.

Step 1:

Obtain the image

Step 2:

Generate 2 × (M × N) RC4 pseudo random numbers for the reverse diffusion

Step 3:

Scan the image column-wise in alternate orientations and then apply the reverse forward and backward diffusions

Step 4:

Scan the image row-wise in alternate orientations and then apply the reverse forward and backward diffusions

Step 5:

Generate M × N RC4 pseudo random numbers for the reverse pixel value rotation

Step 6:

Apply mod 8 for all the values, and replace 0 by the same number as in encryption

Step 7:

Read the image vertically and then apply the reverse alternate left/right circular rotation on pixel by pixel basis

Step 8:

Read the image horizontally and then apply the reverse alternate left/right circular rotation on pixel by pixel basis

Step 9:

Sort PM and PN, find the position of the sorted chaotic values in the original chaotic sequence and store in PM′ and PN′

Step 10:

Circularly rotate each and every column in reverse alternate orientations and the amount of rotation is based on \( PN^{\prime}_{1} , \ldots ,PN^{\prime}_{N} \)

Step 11:

Circularly rotate each and every row in reverse alternate orientations and the amount of rotation is based on \( PM^{\prime}_{1} , \ldots ,PM^{\prime}_{M} \)

Step 12:

Inverse scramble all the columns according to \( PN^{\prime}_{1} , \ldots ,PN^{\prime}_{N} \)

Step 13:

Inverse scramble all the rows according to \( PM^{\prime}_{1} , \ldots ,PM^{\prime}_{M} \)

5 Experiments and Security Analysis

5.1 Experimental Setup

The experiments are carried out on a personal computer configured with intel(R) Core(TM) i3-2120 CPU at 3.30 GHz with 2.91 GB of RAM. The code is developed by using C programming language under the Linux platform. The test images are chosen from the USC-SIPI image database (sipi.usc.edu/database/) and these are 256 × 256 gray-scale images. The initial values and parameters of the Peter De Jong chaotic system is randomly set according to Eq. (3) as \( \{ X_{0} = 0.6, {\text{Y}}_{0} = 0.4, {\text{a}} = 1.77, {\text{b}} = 1.67,c = - 0.85 d = 2.1\} . \)

5.2 Visual Assessment

Figure 3 shows the application of the proposed encryption scheme for three different images with varying content. It can be seen that there is no visual information in the encrypted images. The encrypted images are random-like and highly disordered.

Fig. 3
figure 3

Original images, encrypted images and decrypted images with the proposed scheme a Girl b House c Peppers

5.3 Key-Space Analysis

The chaotic system adopted in this paper is highly sensitive to the initial values and parameters. The key set of the proposed encryption scheme contains 6 parameters {X 0Y 0abcd}. The key-length of the proposed scheme is 384 bits by considering 64 bits for each parameter. And the key-space is 2384, which is sufficient to resist the brute-force attacks. Table 1 shows the key-space of the proposed scheme and some of the other approaches in the literature.

Table 1 Key space of the proposed method and some of the other methods in the literature

5.4 Statistical Analysis

The statistical analysis can be carried out by computing the histograms and the correlations as discussed below.

5.4.1 Histogram Analysis

An image histogram illustrates the frequency distribution of each pixel intensity value [110]. Figure 4 shows the histograms of the original and encrypted images. It can be seen that the histograms of the encrypted images are uniformly spread and are wholly different from that of the original image, and bear no statistical resemblance to the original images. Thus the proposed scheme is resistant to the histogram based statistical attacks. The histograms are also uniformly spread for majority of the schemes in the literature.

Fig. 4
figure 4

Histograms of the original and encrypted images (ac) Histograms of the original images Girl, House and Peppers (df) Histograms of the respective encrypted images

5.4.2 Correlation Analysis

An image encryption scheme should produce the encrypted image with no correlations among the adjacent pixels [17]. The correlation coefficient between the adjacent pixels in an image is determined as in Eqs. (811)

$$ E\left( x \right) = \frac{1}{N}\mathop \sum \limits_{i = 1}^{N} x_{i} $$
(8)
$$ D\left( x \right) = \frac{1}{N}\mathop \sum \limits_{i = 1}^{N} (x_{i} - E\left( x \right))^{2} $$
(9)
$$ cov\left( {x,y} \right) = \frac{1}{N}\mathop \sum \limits_{i = 1}^{N} \left( {x_{i} - E\left( x \right)} \right)\left( {y_{i} - E\left( y \right)} \right) $$
(10)
$$ r_{xy} = \frac{cov(x,y)}{{\sqrt {D(x)} \sqrt {D\left( y \right)} }} $$
(11)

where x and y are the adjacent pixels of the original or encrypted images, E(x) is the mean value, D(x) is the deviation with respect to the mean, cov(xy) is the covariance among the adjacent pixels, and r xy is the correlation coefficient.

Correlations of the original and encrypted images are computed by randomly selecting 2048 pairs of the adjacent pixels in three different orientations: horizontal, vertical, and diagonal. Table 2 shows the outcome of the correlation coefficient calculation. It is observed that the adjacent pixels in the original image are extremely correlated to each other; however the correlation coefficients for the encrypted images are very close to zero. Hence the proposed scheme is resistant to the correlation based statistical attacks. The comparison of the correlation outcome with the other schemes is given in Table 3. It can be seen that correlation results of the proposed scheme is extremely close to zero and comparable to the other schemes in the literature.

Table 2 Correlation coefficients of the adjacent pixels in different orientations for the original and encrypted images
Table 3 Comparison of the correlation coefficients of the proposed scheme with the other methods

5.5 Sensitivity Analysis

An image encryption scheme is expected to be sensitive to both the secret key and the plain image and is demonstrated beneath.

5.5.1 Key Sensitivity

Key sensitivity implies that a minute change of the key should produce a drastic change in the encrypted image by using the same plain image [110]. The key sensitivity test has been conducted with the following steps.

Step 1:

Encrypt the plain image with a key K 1 to produce a cipher image C 1

Step 2:

Create a key K 2 from key K 1 with a small change; Encrypt the plain image again with key K 2 to produce the cipher image C 2

Step 3:

Compare the two cipher images C 1 and C 2 to observe the number of differing pixels

To quantitatively test the influence of minute alterations in the key, two common measures are used, i.e., number of pixels change rate (NPCR) and unified average changing intensity (UACI), they are determined as in Eqs. (1214)

$$ NPCR = \frac{{\mathop \sum \nolimits_{{i,j}} D(i,j)}}{{M \times N}} \times 100\,\% $$
(12)
$$ D\left( {i,j} \right) = \left\{ {\begin{array}{*{20}l} {1, \quad if\;C_{1} \left( {i,j} \right) \ne C_{2} \left( {i,j} \right)} \\ {0, \quad Otherwise } \\ \end{array} } \right. $$
(13)
$$UACI = \frac{1}{{M \times N}}\left[ {\mathop \sum \limits_{{ij}} \frac{{C_{1} \left( {i,j} \right) - C_{2} \left( {i,j} \right)}}{{255}}} \right] \times 100\% $$
(14)

where C 1 and C 2 are the two encrypted images with slight different keys K 1 and K 2. C 1(i, j) and C 2(ij) are the pixel intensity values at the location (ij). D is a bipolar array with the same size as C 1 and C 2 and its contents are either 0 or 1 based on Eq. (13).

The key sensitivity is assessed by testing one parameter at a time with a minute change in the key. The key set of the proposed scheme contain six parameters {X 0Y 0abcd}. The original key is altered with minute changes and six different keys are generated. The keys can be summarized as,

the original key,

$$ K_{1} = \{ 0.6, 0.4, 1.77, 1.67, - 0.85, 2.1\} $$

and the slightly altered keys,

$$ K_{2} = \{{\bf {0.600000001}}, 0.4, 1.77, 1.67, - 0.85, 2.1\} $$
$$ K_{3} = \{ 0.6, {\bf {0.400000001}}, 1.77, 1.67, - 0.85, 2.1\} $$
$$ K_{4} = \{ 0.6, 0.4, {\bf {1.770000001}}, 1.67, - 0.85, 2.1\} $$
$$ K_{5} = \{ 0.6, 0.4, 1.77, {\bf {1.670000001}}, - 0.85, 2.1\} $$
$$ K_{6} = \{ 0.6, 0.4, 1.77, 1.67, -{\bf {0.850000001}}, 2.1\} $$
$$ K_{7} = \{ 0.6, 0.4, 1.77, 1.67, - 0.85, {\bf {2.100000001}}\} $$

Table 4 shows the result of the key sensitivity test for six different parameters. It can be seen that the NPCR and UACI values are close to their ideal values of 99.6 and 33.4 %. Thus the proposed scheme has high key sensitivity. The key sensitivity results in the literature are satisfactory and are demonstrated in the visual form hence are not shown here.

Table 4 Key sensitivity results with different parameters of the chaotic map

In addition, the key sensitivity results are also shown pictorially in Fig. 5. The encrypted images with the correct key (K 1) and the incorrect key (K 2) are shown in Fig. 5b, c. Even though they look similar, they are entirely different from each other. This can be seen by observing the difference image given in Fig. 5d.

Fig. 5
figure 5

Key sensitivity test for the encryption process for the Lena image a original image b encrypted image with the correct key c encrypted images with slightly different key d difference image between b and c

Furthermore, the key sensitivity test is also analyzed for the decryption process. The decryption is performed with the correct key (K 1) and the slight altered key (K 2). The Fig. 6b shows the decrypted image with the correct key and Fig. 6c shows the decrypted image with slight altered key. The decrypted image with slight altered key is random-like and thus it is observed that the correct decryption cannot be attained if there is a small alteration in the key.

Fig. 6
figure 6

Key sensitivity test for the decryption process for the Lena image. a original image b decryption with the correct key c decryption with the slight changed key

5.5.2 Plain Image Sensitivity

Plain image sensitivity implies that, a 1-bit alteration of the plain image should produce a drastic change in the encrypted image by using the same key [110]. The plain-image sensitivity analysis is conducted with the following steps.

Step 1:

Encrypt the original image to produce a cipher image C 1

Step 2:

Alter 1-bit of the original image at any arbitrary location, and encrypt again to produce the cipher image C 2

Step 3:

Compare the two cipher images C 1 and C 2 to observe the number of differing pixels

Two common measures NPCR and UACI are used to test the influence of 1-bit alteration in the plain image. Table 5 shows the outcome of the plain image sensitivity test for an arbitrarily chosen position (60, 195). The pixel intensity value of the selected position is 223. The NPCR and UACI values are observed by changing one bit at a time from the lower bit to the upper bit. The average NPCR and UACI values are found to be 99.616815 and 33.465988 % and these values are close to their ideal values of 99.6 and 33.4 %. Thus, the proposed encryption scheme has higher plain image sensitivity and is resistant to the differential attacks. Table 6 lists the plain image sensitivity results of the proposed scheme and the other schemes in the literature. The plain image sensitivity results of the proposed scheme are comparable to other schemes and are close the ideal values.

Table 5 Plain image sensitivity test
Table 6 Comparison of the plain image sensitivity results with the other schemes in the literature

5.6 Information Entropy Analysis

Information entropy is a measure of the amount of randomness in information content, and is determined as given below [15],

$$ H\left( S \right) = \mathop \sum \limits_{i = 0}^{n - 1} P\left( {S_{i} } \right) { \log }_{2} \frac{1}{{P(S_{i} )}} $$
(15)

where S i represents the pixel values, P(S i ) is the probability of the symbol S i and n is the total number of symbols and it is 256 for the gray scale images. Suppose that, the source emits 28 symbols with the same probability, i.e. S = (S 0S 1S 2, …, S 255) after evaluating Eq. (15), we obtain its entropy H(S) = 8. Table 7 shows the outcome of the entropy calculation. It can be seen that the entropies of the encrypted images are extremely close to the ideal value of 8. Hence the information outflow in the proposed encryption process is insignificant and is resistant against the entropy based attacks. The comparison of the entropy outcome with the other schemes is listed in Table 8. The entropy outcome of the proposed scheme is close to the ideal value of 8 and is comparable to other schemes in the literature.

Table 7 Entropy values for original and encrypted images for different images
Table 8 Comparison of the entropy values of the proposed scheme with the other methods

5.7 Peak Signal to Noise Ratio (PSNR) Analysis

The objective evaluation of an encryption scheme can be performed by computing the PSNR. In this evaluation, the original plain image is considered as a signal and the encrypted image is considered as a noise [4]. The PSNR is calculated as,

$$ PSNR = 20 \times { \log }_{10} \left( {\frac{255}{{\sqrt {MSE} }} } \right)dB $$
(16)

where MSE is the mean square error and is computed as,

$$ MSE = \frac{1}{MN}\mathop \sum \limits_{i = 1}^{M} \mathop \sum \limits_{j = 1}^{N} ( |I\left( {i,j} \right) - I^{\prime}\left( {i,j} \right)| )^{2} $$
(17)

where I(ij) is the pixel value of the original plain image and I′(ij) is the pixel value of the encrypted image at location (i, j). The PSNR results for the different test images are listed in Table 9. It can be seen that the PSNR values are lower, which indicates the complexity in getting the original plain image from the encrypted image for adversaries. The comparison of the PSNR outcome with the other schemes is listed in Table 10. The PSNR outcome of the proposed scheme is lower and is comparable to other schemes in the literature.

Table 9 The PSNR values for different test images
Table 10 Comparison of the PSNR values of the proposed scheme with the other methods

5.8 Computational Speed Analysis

The running time of an encryption scheme can be determined by several factors such as the operating system, programming language, system configuration etc. The proposed encryption scheme is coded in C language under the Linux environment. The time taken to encrypt a 256 × 256 gray scale image is 0.000006 s and for decryption it is the same. Moreover two rounds of the encryption function provide sufficient security. Table 11 shows the computational time requirement of the proposed scheme and the other schemes in the literature. The proposed scheme requires only 0.000006 s and the time cost is 10−5. The time cost of [16] varies from 100 to 10−2. The time cost of the proposed scheme is also observed on system with differing speeds. The time cost of the proposed scheme at 2.7 and 1.7 GHz are found to be 10−5 and 10−4 respectievely. Hence the proposed scheme is faster than [16]. The time complexity of the proposed algorithm consists of four terms as specified in Table 12. The time complexities of the proposed scheme and other schemes are listed in Table 13. It can be seen that the time complexity of the proposed scheme is lower and it is faster than [16].

Table 11 Comparison of the computational time with the other schemes in the literature
Table 12 Time complexity of the proposed algorithm
Table 13 Comparison of the time complexities with the other schemes in the literature

6 Conclusions

In this work, an efficient image encryption scheme based on a Peter De Jong chaotic map and a RC4 stream cipher is presented. The proposed scheme has adequate key space of 2384, hence the brute-force attacks are infeasible. The correlations are close to zero in all the three directions and the histogram is almost uniformly distributed, thus the statistical attacks are resisted. Furthermore, the NPCR and UACI values are close to their ideal values of 99.6 and 33.4 % for both the key sensitivity and plain image sensitivity tests, hence the scheme is resistant to the differential attacks. In addition, the average entropy attained is 7.997120, which is close to the ideal value of 8, and hence the information leakage is negligible. The PSNR is lower. The proposed scheme is coded in C under the Linux environment and the speed attained is 0.000006 s for 256 × 256 images. Moreover only two rounds of the encryption function provide sufficient security; hence the proposed encryption scheme is computationally fast with security intact.