1 Introduction

To convey a message, an image is more helpful than text. Content of an image is easily understood by anybody present in any corner of the world. However, to convey some information using text, two pre-requisites are required. First, the receiver must be a literate person (images are understood by illiterates as well); second, sender and receiver must be well versed with at least one common language. Thus, image is generally preferred over text. However, advances of information technology have brought everyone on the planet on Internet. Which is why, images used in communication are vulnerable to attacks. One of the feasible solutions is cryptography. Cryptography converts a meaningful image into some random collection of pixel intensities (called encrypted image); making it look like some random noise. With only correct and precise keys, the encrypted image can be decrypted to give the original image back. Encrypted image reveals nothing to the intruders. For an additional layer of security, the encrypted image is added to naïve looking 2D or 3D image [25]. Encryption of plain image can be carried out in optical and digital domain. Optical encryption methods use fractional Fourier transform [26, 27], double random phase encoding [28], wavelength multiplexing [29] and other multiplexing methods [30, 31]. However, as pointed out in [28] some inherent weaknesses of optical methods inhibit their use in image encryption. The proposed image encryption uses digital methods to encrypt image and is based on two chaotic maps—Ikeda map and logistic map.

As reported in a recent survey on image encryption [1], in the 2018 only, about a thousand plus publications have been found related to the field of image encryption. Hence, area of image encryption has piqued the interests of researchers and is continuing to do so. While encrypted image can be sent directly over the communication channel, it can be hidden inside a cover media in an invisible manner [2]. A typical image encryption model consists of two stages—permutation and substitution as pointed out in [3] which is shown in Fig. 1. In the present paper, a novel image encryption algorithm is proposed which utilises two chaotic maps—Ikeda map and logistic chaotic map. Diffusion or substitution is carried out at pixel level while confusion is done at the pixel level while the confusion or permutation is done at the bit level.

Fig. 1
figure 1

Skeleton of a typical image encryption procedure

The structure of the proposed paper is as follows. Chaotic maps and their advantages are discussed in Sect. 2. A brief review of related image encryption methods is presented in Sect. 3. The proposed algorithm is presented in detail in Sect. 4. Results obtained from simulation of proposed algorithm and comparisons with state of the art approaches is presented in detail in Sect. 5, followed by conclusion in Sect. 6.

2 Chaotic maps

Chaotic maps exhibit various favourable characteristics which make them suitable to be used in image encryption process. These characteristics are—pseudo-randomness, extreme sensitivity towards any change in initial conditions (or control parameters) and ergodicity. In the proposed paper, two chaotic maps are used.

2.1 Ikeda map

The original chaotic map was proposed by Kensuke Ikeda during his experiment [4]. Complex Ikeda map is defined in 2D space as follows:

$${x}_{n+1}=1+\mu ({x}_{n}\mathrm{cos}{t}_{n} - {y}_{n}\mathrm{sin}{t}_{n}),$$
(1)
$${y}_{n+1}= \mu ({x}_{n}\mathrm{sin}{t}_{n} -{y}_{n}\mathrm{cos}{t}_{n}),$$
(2)
$${t}_{n}=0.4- \frac{6}{1+{x}_{n}^{2}+ {y}_{n}^{2}},$$
(3)

where \(\mu \) is control parameter. 2D Ikeda map exhibits chaotic behaviour when \(\mu \ge 0.6\). To obtain \(xy\) chaotic attractors of Ikeda map, \(\mu =0.9\) is chosen. Twenty starting points were taken and their trajectories were traced as shown in Fig. 2.

Fig. 2
figure 2

Chaotic attractors of Ikeda map

In this figure, as can be observed \(x\in \left(-40, 35\right)\) and \(y \in (-30, 30)\). To use Ikeda map for diffusion process of image encryption, these chaotic sequences were taken down to range \((\mathrm{0,1})\).

2.2 Logistic chaotic map

Logistic chaotic map is the most popular chaotic map used in several image encryption algorithms. Mathematically, 1D logistic chaotic map is defined as follows:

$${x}_{n+1}= \mu {x}_{n}\left(1- {x}_{n}\right),$$
(4)

where \(\mu \) is the control parameter. For \(\mu >3.569945\), the system goes into chaotic state [5]. Bifurcation diagram obtained by implementing 1D logistic map in Matlab has been shown in Fig. 3. As can be observed, for the specified range of \(\mu \), chaos is exhibited by the map.

Fig. 3
figure 3

Bifurcation diagram of logistic map obtained in Matlab

Chaotic sequence obtained from 1D logistic map is used in the confusion or permutation process of the proposed image encryption algorithm. A brief review of the above two chaotic maps used in image encryption is presented in next section.

3 Related works

While logistic chaotic map is used in various image encryption techniques proposed so far in the literature; use of Ikeda map for construction of chaotic sequences in image encryption is limited to a very few image encryption algorithms [6]. Since the present work is for the image encryption of grayscale images using Ikeda map, literature review of grayscale image encryption schemes using Ikeda map is presented.

Jia [7] used only Ikeda map for both phases-pixel shuffling (using the sort indices) and pixel substitution. The results obtained from simulation of the algorithm were shown to be robust against the histogram analysis, correlation analysis and key sensitivity analysis. Zhu et al. [8] proposed a bit level permutation than a pixel level permutation. In their approach, Arnold cat map has been used for permutation and for diffusion, logistic map has been used. Mannai et al. [9] proposed discretised version of Ikeda system. Chaotic sequence obtained from discretised Ikeda map is XORed with the plain image pixels to obtain encrypted image. Alshibani et al. [10] used a mix of three Arnold transform, Henon map and Ikeda map for diffusion phase of grayscale images. In this paper, DNA encoding of pixels of plain image and masking key was done. Exclusive OR operation was performed between DNA sequences of plain image and that of masking key. Masking key was obtained using sort operation on the chaotic sequences of Henon map and Ikeda map. Parvees et al. [11] proposed colour image encryption algorithm using Ikeda map and logistic map. For each colour channel, separate chaotic sequences from Ikeda map and logistic map were generated. Şekertekin et al. [12] used Ikeda map for permutation and Henon map for diffusion. Becheikh et al. [13] used 1D Ikeda map and T-function for generation of a S-box which is used for grayscale image encryption. The proposed S-box was proved to have various essential properties such as bijectivity, bit independence criterion (BIC), nonlinearity, strict avalanche criterion (SAC), differential and linear approximation probability. Hikal et al. [14] proposed encryption scheme for palm print images. Since palm print images carry unique information of palm lines, shape, and texture of an individual; these are most reliable biometric authenticators. In addition, decryption process should be able to give back the exactly same plain image because a loss of even a pixel may cause the palm print matching mechanism to fail. The authors used a mix of three chaotic maps—Arnold’s cat map (for confusion) and Ikeda map and enhanced Lorenz map for diffusion of pixels in confused (or permutated) image. Li et al. [15] obtained two chaotic sequences from Ikeda map and used one chaotic sequence for confusion phase and other for diffusion phase. In their approach, the authors proposed a novel approach for encrypting a Preview-Region-Image. The encrypted image and encrypted preview image are placed in Ciphered image. First, the encrypted Preview-Region-Image is decrypted and afterwards encrypted image. This is useful as it saves time in decrypting only the images of interest and not all encrypted images. A recent research by Girdhar et al. [16] applied XOR operations on chaotic sequences obtained from Lorenz and Rossler hyperchaotic system and colour image pixels and very nice results were obtained.

There are a few things that can be observed from this literature review:

  • XOR operation on chaotic sequences and image pixel value results in encrypted image.

  • Use of Ikeda map increases randomness in plain image.

  • As pointed in the review, modification at bit level is preferred over the pixel level.

Keeping the above-mentioned points in mind, an image encryption algorithm is proposed in the next section.

4 Image encryption algorithm

A brief overview of the approach is shown in Fig. 4. A plain image is taken on which diffusion is done using chaotic sequence from Ikeda map and confusion is done using chaotic sequence from logistic map.

Fig. 4
figure 4

Brief layout of image encryption algorithm

As the proposed image encryption process consists of two phases—diffusion and confusion, the encryption algorithm is explained in two parts—first diffusion process followed by confusion.

4.1 Diffusion process

  1. 1.

    Read plain image (I) of dimension (M × N = R).

  2. 2.

    Divide I into two vertical halves—I1 and I2 each of size M × (N/2).

  3. 3.

    Next, obtain chaotic sequences from Ikeda map of size R/2.

  4. 4.

    To ensure that the chaotic sequences have unique value, algorithm in [17] is used. This results in two chaotic sequences—x, y which are unique with values lying in [1, R/2].

  5. 5.

    Reshape both x and y arrays to be of same dimension as that of I1 and I2.

  6. 6.

    Apply sort operation on x and y arrays in column wise direction and keep sort_indices in separate arrays as shown in Fig. 5. It is to be kept in mind that the unsorted x and y arrays will be used in the algorithm and sort operation is done to obtain the sort_indices of these two arrays.

  7. 7.

    Next, using sort_indices_y array, perform bitXOR operation on I1 and x to obtain \({I}_{1}^{^{\prime}}\). This step is explained in Fig. 6.

  8. 8.

    Similarly, using sort_indices_x array, perform bitXOR operation on I2 and y to obtain \({I}_{2}^{^{\prime}}\).

  9. 9.

    \({I}_{1}^{^{\prime}}\) and \({I}_{2}^{^{\prime}}\) are combined to form \({I}^{^{\prime}}\).

  10. 10.

    Now, \({I}^{^{\prime}}\) is divided into two horizontal halves—I3 and I4 each of size (M/2) × N.

  11. 11.

    Again, x and y arrays are reshaped to be same dimension as that of I3 and I4.

  12. 12.

    Apply sort operation on x and y arrays in row wise direction and keep sort_indices in separate arrays as shown in Fig. 7. Again, unsorted x and y arrays will be used in the algorithm and sort operation is done to obtain the sort_indices of these two arrays.

  13. 13.

    Now, using sort_indices_x, bitXOR is performed between I3 and y arrays to obtain \({I}_{3}^{^{\prime}}\). This step is explained in Fig. 8.

  14. 14.

    Similarly, using sort_indices_y, I4 and x arrays are bitXORed to give \({I}_{4}^{^{\prime}}\).

  15. 15.

    Afterwards, \({I}_{3}^{^{\prime}}\) and \({I}_{4}^{^{\prime}}\) are combined to give encrypted image after diffusion (\({\mathrm{EI}}_{D}\)). \({\mathrm{EI}}_{D}\) is then taken to the confusion phase.

Fig. 5
figure 5

Sort a y array in vertical direction to obtain b sort_indices_y array and c sorted_y array

Fig. 6
figure 6

BitXOR operation on a I1 and b x using c sort_indices_y to obtain d I1

Fig. 7
figure 7

Sort a x array in horizontal direction to obtain b sort_indices_x array and c sorted_x array

Fig. 8
figure 8

bitXOR operation on a I3 and b y using c sort_indices_x to obtain d I3

4.2 Confusion process

Following steps are performed over the encrypted image after diffusion (\({\mathrm{EI}}_{D}\)) in this process.

  1. 1.

    All intensity levels of the plain image (I) are added to form \(S\).

  2. 2.

    Next, \(S\) is divided by suitable power of 10 so that newly formed \(S<1\).

  3. 3.

    Add \(S\) to the initial value of logistic chaotic map so that a unique chaotic sequence is generated for every plain image.

  4. 4.

    Apply modulo-by-8 operation on the chaotic sequence generated from the above written step, resulting in a chaotic sequence from the range [0, 7].

  5. 5.

    Pixel value from \({\mathrm{EI}}_{D}\) is read and converted to binary bits in a 8-bit representation.

  6. 6.

    Read a value from chaotic sequence and perform right circular shift on the binary bit representation. This is the permutation step and it not only permutes the binary bits of a pixel but also changes the pixel value. An example of this step is shown in Fig. 9 where a pixel value of \({\left(15\right)}_{10}\) is converted to \({\left(240\right)}_{10}\), considering value = 4.

  7. 7.

    Repeat the entire process of all pixel intensities in the \({\mathrm{EI}}_{D}\).

  8. 8.

    Afterwards, convert all binary bit representations to decimal intensities to receive the final encrypted image.

Fig. 9
figure 9

Right circular shift by four places changes pixel intensity from (15)10 to (240)10

The entire process of the confusion process is summarised in Fig. 10.

Fig. 10
figure 10

Confusion process of the proposed approach

To decrypt the encrypted image, exact secret key is to be used and the entire process of encryption is to repeated, but in reverse order. This implies that, first confusion process is done on the encrypted image. During the confusion phase, first decimal valued intensities are converted to the binary bit representations of 8 bits. Exact same chaotic sequence is generated using the same initial conditions. Perform right circular shift on the binary bit representations to get \({\mathrm{EI}}_{D}\). Next, diffusion process is repeated with steps performed in reverse order to get decrypted image which is exactly same to I.

5 Results obtained from simulation

The proposed algorithm was implemented in Matlab and run on a i7 processor with an 8-GB RAM. Table 1 shows plain, encrypted and decrypted images. As can be observed in the table, encrypted image is seemingly a random image and does not reveal anything.

Table 1 Plain, encrypted and decrypted images

5.1 Key space and key sensitivity

As the proposed image encryption uses two secret keys for Ikeda map generation and one for logistic map generation, each having precision up to 10–15 decimal places, 1045 (= 1015 × 1015 × 1015) brute force attacks would be required to break the system. Large key space ensues safety from brute force attackers. Next, key sensitivity can be ensured by decrypting encrypted image with a slightly modified key. If the decryption process fails to decrypt the encrypted image, then sensitivity of secret key is realised (Fig. 11).

Fig. 11
figure 11

a Plain image, b encrypted image, decrypted image using c wrong key and d right key

5.2 Statistical analysis

Encrypted images are attacked by statistical analysers to extract information about it. Statistical information about encrypted image is extracted to examine if a seemingly noisy image is carrying any meaningful message or not. This is done by obtaining histogram of the encrypted image and drawing correlations among the pixels.

5.2.1 Histogram analysis

Histogram drawn for a true random image would have absolutely uniform histogram bars [16] because frequency of all pixel intensities is equal. An ideal histogram is shown in Fig. 12 where height of pixel intensities is exactly same.

Fig. 12
figure 12

Uniform histogram bars (a) obtained for a truly random image (b)

Histogram for both plain image of baboon and respective encrypted image was obtained as shown in Fig. 13. Uniformity in histogram of encrypted image of baboon can be observed from the figure.

Fig. 13
figure 13

Histogram of plain image (a) in (b); encrypted image (c) in (d)

5.2.2 Correlation analysis

In a plain image, correlations among adjacent pixels in vertical, horizontal and diagonal directions exist in such a way that the correlation coefficient ≈ 1. However, the encryption algorithm should be able to destroy the correlations among pixels in all three directions. Calculation of correlation coefficient is done using formula mentioned in [16]. Correlation coefficient between neighbouring pixels in horizontal direction \(x\) and \(y\) is calculated as follows:

$$E\left(x\right)= \frac{1}{T}\sum_{i=1}^{T}{x}_{i},$$
(5)

where \(E\left(x\right)\) is the mean value of pixel intensities of total number of pixels which are selected randomly from image.

After finding \(E\left(x\right)\), deviation from mean value and covariance is calculated using the following formula:

$${D}_{x}= \frac{1}{T}\sum_{i=1}^{T}{({x}_{i}- E\left(x\right))}^{2},$$
(6)
$$\mathrm{cov}\left(x,y\right)= \frac{1}{T}\sum_{i=1}^{T}\left({x}_{i}-E\left(x\right)\right)\left({y}_{i}-E \left(y\right)\right),$$
(7)

Using deviation and covariance values, correlation coefficient is calculated as follows:

$${r}_{xy}= \frac{\mathrm{cov}(x,y)}{\sqrt{{D}_{x}}\sqrt{{D}_{y}}}.$$
(8)

Table 2 was obtained for correlation coefficient among pixels of both plain image and encrypted image in horizontal, vertical and diagonal directions for 3000 pixels chosen randomly.

Table 2 Correlation coefficient of neighbouring pixels in horizontal, vertical and diagonal directions

It can be observed from this table that the correlations among neighbouring pixels in horizontal vertical and diagonal directions have been destroyed. Hence, significant descent in correlation coefficient values in encrypted images (Fig. 14).

Fig. 14
figure 14

Correlation coefficient plots for plain (on left) and encrypted image (on right) of Baboon

It is evident from the figure, that pixels are very closely related in plain image of Baboon in horizontal, vertical and diagonal direction. However, pixel intensities are sparsely located from one another in the encrypted image. Thus, correlations of plain image are destroyed completely by the proposed encryption algorithm.

A comparison with some recent research works in the area of image encryption is shown in Table 3. As can be observed that the encrypted images obtained from proposed image encryption algorithm is able to reduce the correlations among pixels in the best manner. This is because confusion process of the proposed image encryption algorithm works at the bit level. Whereas, all the image encryption algorithms against which comparison is being done, do not perform any operation at bit level. Thus, it can be deduced that operations carried out at bit level encrypt image in a much better way.

Table 3 Comparison in terms of correlation coefficient with some recent works

5.3 Differential attack analysis

Differential attack analysis is conducted by attackers to establish a relationship between plain image and encrypted image. To determine potency of encryption algorithm to withstand this attack, two parameters—number of pixels change rate (NPCR) and unified average changing intensity (UACI) are determined. Evaluation of NPCR and UACI is done using two encrypted images. A pixel is chosen at random in plain image and changed to form a new plain image. Then, both plain image and new plain image are encrypted to receive two encrypted images \({E}_{1}\) and \({E}_{2}\). Using following formulae and \({E}_{1}\) and \({E}_{2}\), value of NPCR and UACI is determined [18] and mentioned in Table 4:

Table 4 NPCR and UACI values for encrypted images of respective plain images
$$D\left(i,j\right)= \left\{\begin{array}{l}0 \, {\text{if}} \, {E}_{1}\left(i,j\right)= {E}_{2}(i,j)\\ 1 \, {\text{otherwise}}\end{array}\right.,$$
(9)
$$\mathrm{NPCR}=\frac{ \sum_{i=1}^{N}\sum_{j=1}^{M}D(i,j)}{N\times M}\times 100,$$
(10)
$$\mathrm{UACI}=\frac{\sum_{i=1}^{N}\sum_{j=1}^{M}\frac{{E}_{1}\left(i,j\right)-{E}_{2}(i,j)}{255}}{N\times M}.$$
(11)

5.4 Information entropy analysis

Information entropy is a measure of randomness in a system. Higher value of information entropy of a system, higher is the randomness or disturbance in the system. Information entropy of an image is calculated using the following formula [19]:

$$H\left(m\right)= \sum_{i=0}^{{2}^{n}-1}p({m}_{i}){\mathrm{log}}_{2}\frac{1}{p({m}_{i})}.$$
(12)

where \(p({m}_{i})\) is probability of appearance of \({m}_{i}\) in image and \(n\) represents different grey planes. Since a grayscale image contains eight planes, the maximum value of entropy of using formula stated above comes out to be 8. Hence, as close to 8, entropy of an image is, as close to being random the image is. Table 5 lists information entropy values of plain and encrypted images. It can be seen from the table that the information entropy of the images has increased as a result of the encryption algorithm.

Table 5 Information entropy of plain and encrypted images

5.5 Encryption speed

Speed is another parameter to determine the potency of an image encryption algorithm. Since speed of a procedure is highly dependent on hardware on which it is implemented, a point-to-point comparison cannot be made. Nevertheless, encryption times (in terms of ms) as put up by some research works are taken and compared with the proposed algorithm as jotted down in Table 6. Speed of the proposed algorithm is measured in Matlab using commands tic and toc.

Table 6 Comparison in terms of encryption speed (in ms)

As can be observed, the proposed image encryption takes suitably less time in encrypting a plain image as compared to other research works.

6 Conclusion

The proposed image encryption algorithm encrypts a given plain grayscale image using Ikeda map at pixel level and logistic map at bit level. Encrypted image is obtained by applying bitXOR operations on horizontal and vertical halves of the plain image and the applying circular shift operations bitwise on all pixel intensities of confused image. The proposed image encryption algorithm has been simulated and the results are evaluated under differential, statistical and brute force attacks. Comparison with some recent works of grayscale image encryption algorithms is also presented. The novelty of the proposed work lies in the manner in which encryption algorithm is applied. Only two chaotic sequences are used for producing such promising results. Blocking and halving is not new, however, unequal halving has not been done prior to the best knowledge of the authors. Introducing more and more chaotic sequences increases both time and space complexity. Hence, this novel grayscale algorithm is the need of the hour and will entice the audience and readers to create efficient and less complex (in terms of time and space) grayscale image encryption algorithm.