1 Introduction

The introduction of the internet in the early 1990s by the United States equipped users with the ability to communicate and share data at no matter of time. However, due to a lack of knowledge and availability of suitable protection mechanisms, this freedom results in the interception of intruders in accessing digital data. The scenario resulted in the need for a suitable security mechanism that must fulfil three primary goals; Confidentiality, Integrity, and Availability; lack of any of the entities from the triad may lead to data loss or, in the worst case, provide access to the complete system to a hacker or cracker. It is imperative to design a security mechanism to resist both the active and passive attacks employed by the attacker to gain access. In terms of image encryption schemes, this can be achieved by employing high brute force search time, large key-space, high key sensitive mechanism, and a highly randomized pseudo-random number generator (PRNG), which altogether makes it very difficult for a hacker or cracker to penetrate through.

This paper aims to develop an impenetrable image encryption scheme to provide the solution to the problems discussed. The proposed scheme offers a very high brute force search time, a very large key-space, a very high key sensitive mechanism, and multi-level encryption, and the scheme also employs a highly randomized random number generator which is an unsupervised deep learning algorithm trained on random sequences generated by traditional logistic maps. To achieve this, the proposed image encryption scheme consists of highly randomized key-dependent confusion and diffusion processes; both processes use highly randomize sets of keys generated by the GAN [7, 9, 13, 17, 24, 35] at the individual level, making it impossible to find the way back to the valuable input image.

The rest of the paper is discussed as follows: Section 2, “Literature Survey,” scatters light on the past and present developments in the field of image encryption based on image processing and deep learning; it also focuses on the adoption of various evaluation matrices for better understanding and comparison. Section 3, “Proposed Image Encryption Scheme,” provides a brief discussion on the developed image encryption scheme. Section 3.4, “Evaluation Metric,” revolves around pre-setting a metric to justify the robustness of an image encryption technique based on image processing and deep learning. Section 4, “Results,” presents the result for the proposed technique based on the pre-set Evaluation Metric and a brief comparison with the techniques present in the literature. Section 5.6.1, “Conclusion,” presents the overall conclusion deduced during the research and the comparison done. Section 5.6.2, “Motivation,” contains the papers that this research is inspired with, followed by the list of References.

Table 1 represents the list of abbreviations that are used throughout this paper.

Table 1 Abbreviation table

2 Literature survey

This section discusses the numerous image encryption schemes based on image processing and deep learning [28,29,30]. The overall trends of the research in the encryption field are listed in Table 2. In I. Shatheesh Sam et al.in [40], the proposed scheme employed intertwining chaotic maps, in which the confusion process consists of permutation and byte-level substitution followed by a diffusion box that performs nonlinear diffusion and sub-diagonal diffusion.

Table 2 Literature survey table for image processing based image encryption algorithm

In X. Liao et al. [25] the algorithm employs wave’s superposition principle and XOR operation. The input original image is split into two equal halves; and each half is encrypted using wave transmission encryption with four waves. A. Akhshani et al. in [3] proposed an encryption based on the quantum logistic maps. The scheme makes use of the dissipative quantum systems for the development of image encryption mechanism based on quantum logistic maps. I. Sam et al. in [39] proposed a scheme for encryption of coloured images and can support key sizes between 192 to 400 bits. The technique is based on the transformed logistic maps and consists of confusion and diffusion processes. In confusion box the permutation of image pixels takes place based on the six odd keys and further permuted using the first chaotic key in nonlinear diffusion box followed by the XORing of nonlinear diffusion box output with the second chaotic key, finally the third key is used in the zig-zag diffusion process. M. François et al. in [16] proposed an image encryption scheme based on coupling of chaotic function and XOR function. The algorithm employs chaotic function that uses linear congruence’s. A. A. Abd El-Latif et al. in [2] proposed a quantum chaotic system based colour image encryption scheme. The scheme composed of a substitution box and a diffusion box, in former operation is done on the basis of toral automorphism in integer wavelet transform followed by a diffusion box developed by mixing the feature of horizontally and vertically adjacent pixels on the basis of quantum chaotic map. At last, substitution is accomplished by creating an intermediate chaotic keystream image with quantum chaotic system. M. SaberiKamarposhti et al. in [38] proposed an image encryption scheme based on biological operations and uses a 120 − bit secret key. Initially the image pixels were scrambled using the Deoxyribonucleic Acid (DNA) sequences and the cyclic chaos followed by the pixel value modification based on a mask generated by the cyclic chaos. In R. Bansal et al. [8] the proposed scheme grounded on chaotic maps and vigenere scheme which contain one round which has two iterative stages i.e. diffusion and confusion. The former step involves following stages: Forward diffusion, Matching process (using Vigenere scheme) and Backward Diffusion. G. Hanchinamani et al. in [18] proposed a scheme based on Peter De Jong chaotic map with a Rivest Cipher 4 (RC4) stream cipher. The Peter De Jong is used to control the initial keys for the RC4 stream generator. The method includes three stages: permutation (scrambling of rows and columns), pixel value rotation (circulates each pixel value by M × N random numbers) and diffusion (scan the image in two different ways). H. Liu et al. in [26] proposed an algorithm employing two-dimensional logistic map, used for the generation of keystreams, as initial parameters. An Arnold scrambling algorithm is exploited to permute the component of colour pixel. In the diffusion part authors used folding algorithm for the modification of the diffused pixel value. F. Hu et al. in [21] use the Stacked Auto Encoder (SAE). It offers parallel computing, the network generates two chaotic matrices for creation of total shuffling matrix and series of independence sequence, the first sequence is used to for substitution whereas the other is used for increasing the entropy by creating more confusion between the permuted and encrypted image. G. Ye et al. in [45] proposed work that included three primary operations; permutation, modulation, and diffusion. The information entropy is used for the generation of the keystream. The initial keys in the permutation and the diffusion stages communicate with each other. M. Kumari et al. in [22] proposed an image encryption scheme using intertwining chaotic maps and RC4 stream cipher for the encryption and decryption of the images. Chaotic map was used for the confusion stage and RC4 cipher for generation of key. N. Zhou et al. in [47] used the quantum cross-exchange operation and a 5-Dimention (5D) hyper chaotic system. The key feature of this scheme is employment of quantum channel swapping to swap gray level values of corresponding pixels. X. Liu et al. in [27] employed an inter-intra bit-level Permutation. Image is first converted into enhanced quantum model representation so that permutation can be applied over bit plains. For the intra-bit permutation, sorting of the chaotic sequence is done, and the inter-bit permutation is achieved with qubit operation in selected two-bit planes. Finally, diffusion is carried out with a quantum image XOR operation. X. Zhang et al. in [46] proposed an algorithms that make use of the Secure Hash Algorithm SHA − 256 [6, 33, 34, 36], that generates an irreversible hash sequence This sequence is then broken down into 32 equal parts containing 8 − bits each, which are used to evaluate initial values for the chaotic system. The confusion process is carried out by the employment of logistic maps that scrambles the image globally followed by block diffusion to increase the randomness in encrypted image. C. He et al. in [20] employed a Chaos-based system. The mechanism uses a deep learning network to decipher the encrypted image by first taking the image into a lower dimension space where the information of useful feature can be preserved. Once the lower dimension feature map is obtained, the map is subjected to the deconvolution generator that regenerates the similar image in same dimension as that of input image. M. Kumari et al. in [23] uses a multiple key-dependent processes that utilize these diverse keys to ensure high key sensitivity and resistance to various differential attacks. The confusion box utilizes an electronic code book, initial permutation, and bit plane scrambling followed by the diffusion process, which employed a folding technique along eight directions, exploiting different keys. Y. Ding et al. in [14] proposed DLEDNet for patient data protection in the health sector. It uses the unsupervised deep-learning network Cycle GAN for the learning part and performs image-to-image translation. The learning parameters of the transmitting side network are treated as encryption keys, whereas the learning parameters of the receiver side network are regarded as decryption keys. A. Malik et al. in [31] categorized image encryption algorithms into diverse categories and performed deep analysis, which helped to compare various image encryption algorithms on an extensive dataset and with various evaluation metrics mentioned in the upcoming sections. In M. Alkhelaiwi et al. [5], the authors make use of the Privacy Preserving Deep Learning technique. The proposed model overpowered the existing Convolution Neural Network (CNN) models in terms of diverse performance parameters.

The literature has investigated that no mechanism that optimizes all the provisions of a considerably secure method is available. Thus, digital image security for communication demands distinguished levels of protection to achieve very high brute force search time, a highly key sensitive nature, offer high entropy, a vast key space, and use a highly randomized pseudo-random number generator whose behaviour cannot be decoded easily. Also, the encrypted image must resist all kinds of attacks the intruder performs. Much work has been done on chaotic, quantum and qubit-based techniques for image encryption, but the major issue with these techniques is that they are based on a specific set of equations, and most of them do not pass various randomness tests. In recent years much work has been done in the field of deep learning, such as for solving classification problems, segmentation problems and regression problems; due to its ability to learn, the highly complex and nonlinear tasks hidden that are impossible for a human brain to process. This has motivated their application in image encryption for the last couple of years. These deep learning-based pseudo-random number generators offer highly randomized sequences after learning about various random sequences and even pass more tests than these techniques. The most important of all is that the key space drastically increases due to the addition of learning parameters of the model to exiting key space, making it impenetrable. The proposed scheme offers a highly robust mechanism based on GAN and withstands various noise and geometrical attacks. Various key features of the proposed image encryption scheme are listed below.

  • It offers a very high brute force search time due to the use of a deep learning algorithm.

  • It employs GAN an unsupervised deep learning based robust image encryption technique.

  • It illustrates a high key randomness.

  • The proposed scheme offers a very high key space.

  • It offers byte level encryption at substitution and both byte level and bit level encryption at permutation and diffusion box.

  • The proposed scheme offers a very high key sensitive mechanism for the generation of random numbers.

3 Proposed image encryption scheme

The Fig. 1 shows the complete block diagram of proposed encryption scheme. The process takes a 3-Dimension (3D) image as the input and applies a series of encryption algorithms on it. The encryption is applied at both, bit-level and byte-level to make it difficult for an intruder to decrypt the image. First an image is passed through a substitution box that is divided into two Byte-Level Substitution box i.e. Substitution Box Scheme-(A), Substitution Box Scheme-(B) followed by the Permutation box the is separated into Bit-Level Permutation Box and Byte-Level Permutation Box, these boxes adds a significant amount of confusion in the input image. Once the confusion is completed the image generated by permutation box is passed through a diffusion box that encrypts the image at both bit-level and byte-level, increasing the overall entropy of the encrypted image. The keys to substitution box, permutation box and diffusion box are generated using the trained GAN. The keys are first passed through the key sampling block that samples six sets of the generated encryption keys and drives two new keys i.e. a key for looping process and a key for selection of the folding process in diffusion box. One of the biggest advantages of using such neural network in encryption algorithm is that it provides an extra layer of security, as the intruder now requires both the key and model in order to decipher the image. The proposed scheme also provides a mechanism to withstand the brute force attack, differential attack and other attacks available in the literature. The next subsections show the details of each block used in the block diagram.

Fig. 1
figure 1

Block diagram of (a) complete encryption mechanism at transmitting end, (b) complete decryption mechanism at receiving end

3.1 Generative Adversarial Network (GAN)

The keys to the substitution, permutation and other blocks are given using the Generative Adversarial Network (GAN) [7, 9, 13, 17, 24, 35]. It is an unsupervised deep learning algorithm that consists of two sub-networks; a Generator model and a Discriminator model, which can be a Convolution Neural Network (CNN). As its name depicts, the generator model is responsible for generating new samples that plausibly could have come from an existing distribution of samples on which the network has learned. In contrast, a discriminator network helps a generator network to overcome its wrong learning by classifying its output into correct and false; it helps to fine-tune its and generator models performance minimizing the loss. GAN is the heart of the image encryption scheme that generates highly randomized series.

Dataset for the training GAN network is generated using the Quantum Chaotic Map explained in (Akhshani et al., 2012) [4]. For the generation of random series, these maps use some initial conditions to work on, the initial conditions in [4] are set using x, y, z, xn, yn, zn, r, β in eq. 1.

Quantum Chaotic Map:

$$ \left\{\begin{array}{c}{x}_{n+1}=r\left({x}_n-{\left|{x}_n\right|}^2\right)-r{y}_n,\kern14.25em \\ {}{y}_{n+1}=-{y}_n{e}^{-2\beta }+{e}^{-\beta }r\left[\left(2-{x}_n-{x}_n^{\star}\right){y}_n-{x}_n{z}_n^{\star }-{x}_n^{\star }{z}_n\right],\\ {}{z}_{n+1}=-{z}_n{e}^{-2\beta }+{e}^{-\beta }r\left[2\left(1-{x}_n^{\star}\right){z}_n-2{x}_n{y}_n-{x}_n\right]\kern2.25em \end{array}\right. $$
(1)

Where,

$$ \beta = Dissipation\ parameter $$
$$ {x}_n^{\star }\ and\ {z}_n^{\star }= are\ complex\ conjugate\ of\ x\ and\ z\ respectively $$

If in eq. (1) we put yn = 0, and zn = 0 the map results in one dimensional logistic map.

$$ \left\{{x}_{n+1}=r\left({x}_n-{\left|{x}_n\right|}^2\right)\right. $$
(2)

To train GAN, two sequences are generated using the above reduced map eq. 2. To generate a sequence following steps are followed (Table 3):

Table 3 Algorithm to generate training dataset for GAN

In the above algorithm input x = 0.4523444338 and l = 10 where x is the initial condition and l is the length of numbers required to be generated using the eq. 2. First k values of the sequence generated using eq. (2) are skipped by iterating 1000 times to reduce the transient effect produced at early iterations. In addition Step-3 is done to normalize the output. Step-2 and Step-3 are repeated until l length sequence is generated. This sequence generated is used by substitution, permutation, diffusion and key sampling process.

3.2 Substitution box

The proposed scheme’s substitution box comprises two sub-boxes that perform substitution at the byte level. These boxes are called Byte-Level (A) Substitution Box and the Byte-Level (B) Substitution Box. The general block diagram is shown in Fig. 2. In the proposed scheme, the input image initially passes through the substitution box, where the pixel values are interchanged within the respective planes using eq. 3.

Fig. 2
figure 2

General block diagram of substitution box

$$ New\ Value=\left( Imaege\ List\left[ index\right]+ KeyList\left[ index\right]\right)\%(256) $$
(3)

The input image is initially passed through the first scheme, a vigenere cipher followed by the specially designed scrambling. Both boxes help in reducing the correlation among the pixels in respective planes. The output of the substitution box is highly randomized and efficiently resists visual inspection. This randomness is a result of random series generated by the trained GAN. The substitution box receives two sets of keys; the first set contains a single sequence for the Byte-Level (A) Substitution Box, and the other contains the three sequences for Byte-Level (B) Substitution Box, one for each plane.

The key size for the vigenere cipher is the same as the number of pixels in the entire image. For the image encryption process, the integer values of pixels are dealt with; thus, a slight modification is introduced in the traditional algorithm, which uses the table of integers ranging from 0 to 255 instead of A to Z. The output from this block is then passed to the next stage, where the image is scrambled plane-wise, introducing more randomness and confusion effect.

In this process, the image received by the previous block is again confused but with a different scheme. This scheme does substitution within the three image planes. For each plane, a map containing the random new values is created. Employing these maps, each pixel in the input is substituted with its new corresponding value in the map, creating a highly randomized image with better entropy and less correlation among the pixel values both plane-wise and at the aggregate level. Table 4 represents the pseudocode of the process where the image values are searched in the corresponding random map.

Table 4 Algorithm for proposed Substitution box

3.3 Permutation box

The dual substitution box stage is followed by the permutation box, which performs operations at two different levels; bit-level and byte level, as shown in Fig. 3. It receives two set of encryption keys, one for bit-level permutation consists of three series containing 8 random number each, whereas the encryption keys for other block contains three planes of random numbers.

Fig. 3
figure 3

General block diagram of permutation box

In Bit-Level Permutation Box, the image is permuted at the bit level, with the help of three random arrays, one for each plane. For the first plane, the first series having eight elements is selected. For permutation at the bit level, a pixel is selected and is converted into the binary format, in which each bit is assigned new positions based on the random series. Then the new binary is converted back to the decimal, which results in a new integer value. A similar process is carried out for the remaining two plains. This helps to generate new numbers between 0 to 255, based on repositioning the binary bits to new random positions.

The image generated by the bit-level permutation is transferred to the byte-level permutation, where the permutation occurs in the whole image to permute three maps generated by the GAN, having the same elements as that of the image. The 1st index in Plane-0, Plane-1 and Plane-2 are 2, 9 and 4 respectively, for the byte-level permutation process, the selected index is used to obtain the corresponding value in the GAN generated respective plane, this value acts as the new position of the selected pixel in new image. The value is then placed at this position, to finally create the permuted image which is then send to the diffusion box. Pseudo code for the process is in the Table 5.

Table 5 Algorithm for proposed permutation box

3.4 Diffusion box

The output of the permutation box is received by the diffusion box where the image is diffused, for eliminating any trace of originality; the box employ both levels of diffusions bit-level and byte level. Both the processes make use of XOR operation and two sets of random sequences generated by GAN, in order to diffuse the image. First operation consists of three sequences carrying eight elements each, which will be used in Bit-Level Diffusion Box whereas the second set of key is used in Byte-level Diffusion and carries three planes of random elements. The results show the diffusion process generates a highly disused image that cannot be re-constructed without approved set of keys. Figure 4 shows the general block diagram of the diffusion box.

Fig. 4
figure 4

Block diagram for data formulation

The image entered into the diffusion box, firstly undergoes the Bit-Level Diffusion, in which all the elements of each plane are converted to 8 − bit binary, then starting from left to right one bit is selected a time, these selected bits are then combined together to form a 3 − bit binary. This way, when the generated 3-Bit binary number is converted into decimal, it always results within the range of 1 to 7. This decimal is then placed in a new plane, when the same process is repeated for the remaining 7 − bits and pixels in three planes, total of eight new planes are generated. Before merging these planes to form the final image, XOR operation is performed using the sequence generated by the GAN. The 8 random numbers between 0 and 7 are used as the initial values one for each plane. The number and corresponding plane is selected and the XOR operation is performed element wise. The first element of the first plane is XORed with the random number and the resultant is stored at the selected position, now this newly generated number is XORed with the number present at the next position and new result is stored at the next position and so on. The same process is repeated for the remaining planes. Finally, the planes are again converted to an image by translating the binary of these planes and reconstructing the respective 8 − bit from 3 − bit binary. Once 8 − bit binary is formed they are placed back to respective planes forming the encrypted image. The pseudocode for the bit-level diffusion process is shown in Table 6. The output image is then passed to the Byte-Level Diffusion Box, where diffusion is done using XORing and Folding Process For this the box receives three highly randomized planes. The folding process basically consists of four ways; folding horizontally, vertical, along forward diagonal and backward diagonal.

Table 6 Algorithm for proposed diffusion box

This block along with the 3 randomized planes receives an extra key, which is used to identify the correct sequence of folding process. When the correct key is received the image is passed through approved combination, each sequence consists of 8 folding processes, which also perform XORing simultaneously. These are Horizontal Bottom Half (HBH), Horizontal Upper Half (HUH), Vertical Lower Half (VLH), Vertical Right Half (VRH), Bottom Lower Triangle (BLT), Upper Right Triangle (URT), Bottom Right Triangle (BRT) and finally Upper Left Triangle (ULT). Table 6 represents the corresponding pseudocode for the byte-level diffusion process First the selected part of the input image is XORred with the KeyImage followed by the XOR operation between the mirror pixels while performing the folding.

4 Evaluation metrics

This section discusses evaluation metrics that is used to measure the performance and robustness of the proposed image encryption scheme. Table 7 depicts the various evaluation metrics available in the literature followed by the brief introduction to each of them.

Table 7 Evaluation metric used for comparison

4.1 Visual analysis (VA)

To carry out visual analysis on various encryption algorithms visual inspection is used to determine understand the encryption effect just by looking at encrypted image.

4.2 Statistical analysis (SA)

Statistical analysis collects and explores a large amount of data to discover hidden patterns and trends, for example, immediate change in contrast and structure similarity. In the image encryption schemes, the type of analysis plays an important role, as it helps to judge the relationship between the original and encrypted image, with the help of which the robustness of the scheme can be gauged. In the images, even after encryption, the neighbouring pixels exhibit some level of similarities which can be used to establish a relationship for the decoding process. To perform this analysis Correlation Coefficient (CC) and Histogram Analysis (HA) are used respectively.

4.3 Quantitative analysis (QA)

Quantitative analysis generally means measuring by quantity and involves exploring facts, measures, numbers, and percentages and working with numbers, statistics, formulae, and data. For this analysis Mean Square Error (MSE), Peak Signal to Noise Ratio (PSNR), Entropy (E), Structural Similarity Index (SSIM), and Bit Error Rate (BER) are used respectively.

4.4 Differential attack analysis (DAA)

For this analysis Number of Pixels Change Rate (NPCR) and Unified Average Changing Intensity (UACI) are used.

4.5 Other attack analysis (OAA)

This analysis is conducted to analyse the robustness of an image encryption algorithm against various practical attacks that may incur in communication channel. For this analysis Brute Force Search Time Attack (BFST), Noise Attack (NA), Geometrical Attack (GA), Anti-Occlusion Attack (AOA) and Crypto Analysis (CA) are used.

4.6 Randomness test analysis

Test for randomness in terms of data evaluation, is a test generally performed to analyse the distribution of a set of data to see if it can be described as random or not. For this analysis.

NIST SP 800–22, Chi-Square Test (CST) and Runs Test are used.

4.7 Simulation setup-parameters

This section discusses the detailed use of parameters used for the experimental purposes throughout.

Table 8 shows set-up parameters, used for experimentation of the proposed mechanism. This list shows the information regarding details of dataset and keys used for the scheme. These original keys are used as initial conditions for the Quantum map employed in the projected methodology and modified key values are used for testing key sensitivity of the mechanism. The specifications of the device on which implementation is performed is also detailed in the table.

Table 8 Setup-parameters

5 Results and analysis

The result section showcases the various results investigated during this research and their in depth analysis. The results were computed on three set of images, each set contained 263 standard images in “.png” format. Images in Set-A, Set-B and Set-C shaped (128 × 128 × 3), (256 × 256 × 3), (512 × 512 × 3) respectively.

The result section is discussed as follows 5.1 Snapshots contains the various plots generated using the original image, encrypted image and the decrypted image for different sized inputs for once better clarity, 5.2 Visual Analysis provides an understanding of the robustness of the encryption scheme by visual inspection and the comparison of the results of the proposed model with the other image encryption scheme available in the literature, 5.3 Statistical Analysis discusses the overall results based on correlation coefficient to get the insights of the image data i.e. how its pixels are now related to each other after the encryption process, 5.4 Quantitative Analysis provides a brief comparison of the proposed scheme with other schemes available in the literature on the basis of Mean Square Error (MSE), Peak signal to Noise Ratio (PSNR), Structural Similarity Index (SSIM), Entropy (H) and Bit Error Rate (BER), 5.5 Other Attack Analysis, and finally 5.6 Randomness Test Analysis.

5.1 Snapshots

The Table 9 presents the snapshots of the results from the proposed encryption scheme for Set- B (256, 256, 3). Starting from left to right the very first image is the original input image to the image encryption algorithm, the centre image is the encrypted image generated by the algorithms at transmitting end whereas the last image is the decrypted image at the receiver.

Table 9 Various plots generated for set-b, image shape (256,256,3.)

5.2 Visual analysis (VA)

Various outputs of different image encryption algorithm mechanisms are checked manually and verified if image data or related features are visible after encryption.

5.2.1 Visual inspection (VI)

The output of various encryption algorithm are presented in Table 10 for the visual inspection; it can be seen that no image data is visible after application of encryption algorithm; hence if the image is transmitted through the unsecured channel, the attacker will have no clue what information the encrypted image contains. It can be seen that the proposed image encryption scheme generates a highly-secured encrypted image.

Table 10 Visual analysis table for set-b

5.3 Statistical analysis (SA)

Statistical analysis collects and explores a large amount of data to discover hidden patterns and trends, for example, immediate change in contrast and structure similarity. In the image encryption schemes, the type of analysis plays an important role, as it helps to judge the relationship between the original and encrypted image, with the help of which the robustness of the scheme can be gauged. In the images, even after encryption, the neighboring pixels exhibit some level of similarities which can be used to establish a relationship for the decoding process. For a good encryption scheme, it is good to analyze the results based on these parameters like correlation coefficient and histogram analysis for evaluation and comparison.

5.3.1 Correlation coefficient (CC)

The Correlation Coefficient [2, 3, 5, 8, 12, 16, 18, 21,22,23, 25,26,27, 31, 32, 38,39,40, 45,46,47] results are computed on Set-A, Set-B and Set-C and can be studied in Tables 11, 12 and 13 respectively. The Table 14 represents the overall comparison on the basis of Correlation Coefficient for the most commonly size used in the image, i.e. Set-B. It can be clearly seen that the algorithm generated a highly uncorrelated output with respect to the original input image. Although just by looking the encrypted image in the visual analysis it seemed correlated but in fact the image is highly uncorrelated in all the directions i.e. horizontal, vertical and diagonal. It makes very difficult for the attacker to design decryption hypothesis as there is no nearly 0 correlation. The proposed image encryption scheme over powers the existing IP and DL techniques present in the literature in term of Correlation Coefficient.

$$ {r}_{xy}=\frac{\mathit{\operatorname{cov}}\left(x,y\right)}{\sqrt{D(x)D(y)}} $$
(4)
Table 11 Correlation coefficient results for the proposed algorithm on set-a
Table 12 Correlation coefficient results for the proposed algorithm on set-b
Table 13 Correlation coefficient results for the proposed algorithm on set-c
Table 14 Correlation coefficient results, comparison results with techniques available in the literature on set-b

5.3.2 Histogram analysis (HA)

In this analysis a frequency distribution of pixel value range shows how often each pixel value in an image occurs. A histogram [2, 3, 5, 8, 14, 16, 18, 21,22,23, 25,26,27, 31, 38,39,40, 45,46,47] is the most commonly used graph to show frequency distributions and for analysing the encryption effect. Table 15 shows histogram analysis results of Set-B (256, 256, 3).

Table 15 Various plots generated for set-b, image shape (256,256,3)

From the above experimental results we can see that the proposed algorithm evenly distributes the frequency distribution curve resulting into approximately a straight line curve, which is highly desired by a good image encryption scheme.

5.4 Quantitative analysis (QA)

Quantitative analysis generally means to measure by quantity and involves exploring facts, measures, numbers and percentages, work with numbers, statistics, formulae and data.as the data. Here we are using quantitative analysis in order to analyse the performance of the encryption algorithm on the basis of change in image data. Methods like MSE, PSNR, SSIM, H and BER are used.

5.4.1 Mean square error (MSE)

Table 16 represents the MSE [5, 8, 18, 22, 27, 31, 47] results computed on Set-A, Set-B, and Set-C. Table 17 represents the overall comparison on the basis of MSE for available techniques in the literature. The average MSE value for the proposed scheme is 9262.928652 that is a high than most of the techniques available literature. For given two images of dimension (i, j, k), MSE(O, E) can be calculated according formula as given below:

$$ MSE\left(O,E\right)=\left(\frac{\sum_k{\sum}_i{\sum}_j{\left(O\left(i,j,k\right)-E\left(i,j,k\right)\right)}^2}{N}\right)\times 100 $$
(5)
Table 16 Mean square error results for the proposed algorithm on set-a, set-b and set-c respectively
Table 17 Mean Square Error, results comparison results with techniques available in the literature on set-b

5.4.2 Peak signal to noise ratio (PSNR)

Table 18 represents the PSNR [5, 8, 12, 14, 18, 22, 31, 32, 42, 43, 45] results computed on Set-A, Set-B, and Set-C.

Table 18 Peak signal to noise ratio results for the proposed algorithm on set-a, set-b and set-c

Table 19 represents the overall comparison on the basis of PSNR for available techniques in the literature. The average PSNR value for the proposed scheme is 8.568832147 which is lower than most of the techniques available literature.

Table 19 Peak signal to noise ratio results, comparison results with techniques available in the literature on set-b
$$ PSNR\left(O,E\right)=10\times {\log}_{10}\left(\frac{{\left({I}_{max}\right)}^2}{MSE\left(O,E\right)}\right) $$
(6)

5.4.3 Entropy (H)

Table 20 represents the entropy [2, 3, 8, 16, 18, 22, 23, 26, 27, 31, 32, 38,39,40, 45,46,47] results computed on Set-A, Set-B, and Set-C. Table 21 represents the overall comparison on the basis of entropy for available techniques in the literature. As inferred from table, the average value for the proposed scheme is7.999057982, that is a very high average value in comparison to the results of the available mechanisms in literature with a reduced amount of standard deviation.

Table 20 Entropy results for the proposed algorithm on set-a, set-b and set-c
Table 21 Entropy results, comparison results with techniques available in the literature on set-b
$$ H(x)=-\sum \limits_{i=1}^nP\left({x}_i\right){\log}_2P\left({x}_i\right) $$
(7)

5.4.4 Structural similarity index (SSIM)

Structural Similarity Index (SSIM) [5, 10, 14, 15, 41, 43] is one of the a robust technique for the measurement of image fidelity, according to the basic principal of SSIM for image fidelity measurement the retention of signal structure is of importance [42]. SSIM measures the index value based on luminance value, contrast value and finally structure calculated at patch level. Table 22 represents the SSIM results computed on Set-A, Set-B and Set-C. This depicts the original input image and encrypted image has no structural similarities in common. This is highly recommended by a good image encryption technique.

Table 22 Structural Similarity Index results for the proposed algorithm on set-a, set-b and set-c
$$ S\left(x,y\right)=\left(\frac{2{\mu}_x{\mu}_y+{C}_1}{{\mu_x}^2+{\mu_y}^2+{C}_1}\right)\cdotp \left(\frac{2{\sigma}_x{\sigma}_y+{C}_2}{{\sigma_x}^2+{\sigma_y}^2+{C}_2}\right)\cdotp \left(\frac{\sigma_{xy}+{C}_3}{\sigma_x{\sigma}_y+{C}_3}\right) $$
(8)

5.4.5 Bit error rate (BER)

The bit error rate [31] is defined as the rate at which errors occur in a transmission system. In image encryption point of view it is a very important parameter in characterising the performance of data channels. Table 23 represents the BER results computed on Set-A, Set-B and Set-C. This depicts the BER among the original input image and encrypted image for the proposed image encryption technique.

Table 23 Bit error rate results for the proposed algorithm on set-a, set-b and set-c

5.5 Differential attack analysis (DAA)

The results for the differential attack analysis are as shown in the Tables 24, 25, 26, 27, 28, 29, 30 and 31 it can be seen that the proposed image encryption scheme is able to pass both NPCR and UACI test.

Table 24 NPCR test results for the proposed algorithm on set-a
Table 25 NPCR test results for the proposed algorithm on set-b
Table 26 NPCR test results for the proposed algorithm on Set-C
Table 27 NPCR results, comparison results with techniques available in the literature on Set-B
Table 28 UACI test results for the proposed algorithm on set-a
Table 29 UACI test results for the proposed algorithm on set-b
Table 30 UACI test results for the proposed algorithm on set-c
Table 31 UACI results, comparison results with techniques available in the literature on set-b

5.5.1 Number of pixels change rate (NPCR)

Number of Pixels Change Rate [2, 3, 5, 8, 12, 14, 16, 18, 21,22,23, 25, 26, 31, 32, 38,39,40, 44,45,46] usually abbreviates as NPCR is one of the criteria used to analyse the differential attack. NPCR means the change rate of the number of pixels in ciphered image when one pixel of the original-image is modified. Table 27 depicts the results for NPCR test, and it can be seen that the proposed image encryption schemes robust in nature against attacks, as the average value is above the theoretical NPCR critical values for all levels which is essential to pass the test.

$$ NPCR\left( OC, MC\right)=\frac{\sum_k{\sum}_i{\sum}_j\left| Sign\left( OE\left(i,j,k\right)- ME\left(i,j,k\right)\right)\right|}{N}\times 100\% $$
(9)

5.5.2 Unified average changing intensity (UACI)

Unified Average Changing Intensity [2, 3, 5, 8, 12, 16, 18, 21,22,23, 25, 26, 31, 32, 38,39,40, 44,45,46] usually abbreviated as UACI is the other criteria used to analyse the deferential attack, UACI calculates the average intensity of ciphered image when one pixel of the original-image is modified. Table 31 depicts the results for UACI test, and it can be seen that the proposed image encryption schemes robust in nature against attacks as the average value is between the theoretical UACI critical values for all levels which is essential to pass the test.

$$ UACI\left( OC, MC\right)=\frac{\sum \limits_k\sum \limits_i\sum \limits_j\left| OC\left(i,j,k\right)- MC\left(i,j,k\right)\right|}{N\times 255}\times 100\% $$
(10)

5.6 Other attack analysis (OAA)

These attacks are generally carried out to ensure the good performance of the image encryption algorithm in practical environment as, in practical application the encrypted is exposed to various kinds of distortions caused due to channel noise or attacker etc. it is very important to test an algorithm against these attacks, it consists of key space analysis, noise attack, geometry attack anti occlusion attack etc. Tables 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56 and 57 and depicts these results.

Table 32 Brute force search time attack results comparison results with techniques available in the literature
Table 33 Various plots generated for encrypted image corrupted by Salt and Pepper noise with amount 10 % , 25%and 50% respectively
Table 34 Different types of flip operations on an image used in the analysis of geometrical attack
Table 35 BER results after vertical flipped attack for the proposed algorithm on set-a, set-b and set-c respectively
Table 36 BER results after horizontal flipped attack for the proposed algorithm on set-a, set-b and set-c respectively
Table 37 BER results after vertical then horizontal flipped attack for the proposed algorithm on set-a, set-b and set-c respectively
Table 38 PSNR results, comparison results for horizontal flip attack with techniques available in the literature on set-b
Table 39 BER results, comparison results for flip attack with techniques available in the literature on Set-B
Table 40 Various plots generated for encrypted image corrupted by flip attack on set-c
Table 41 Different types of rotation operations on an image used in the analysis of geometrical attack
Table 42 BER results after clock wise 90° Rotation attack for the proposed algorithm on set-a, set-b and set-c respectively
Table 43 BER results after clock wise 180° Rotation attack for the proposed algorithm on set-a, set-b and set-c respectively
Table 44 BER results after anti-clock wise 90° rotation attack for the proposed algorithm on set-a, set-b and set-c respectively
Table 45 PSNR results, comparison results for Rotation attack with techniques available in the literature on set-b
Table 46 BER results after vertical then rotation attack for the proposed algorithm on set-a, set-b and set-c respectively
Table 47 Various plots generated for encrypted image corrupted by rotation attack on set-c
Table 48 Different types of occluded part images in encrypted image i.e. \( \raisebox{1ex}{$1$}\!\left/ \!\raisebox{-1ex}{$64$}\right.,\raisebox{1ex}{$1$}\!\left/ \!\raisebox{-1ex}{$16$}\right.,\raisebox{1ex}{$1$}\!\left/ \!\raisebox{-1ex}{$4$}\right.,\raisebox{1ex}{$1$}\!\left/ \!\raisebox{-1ex}{$2$}\right.,\raisebox{1ex}{$3$}\!\left/ \!\raisebox{-1ex}{$4$}\right. \)
Table 49 BER results after \( \raisebox{1ex}{$1$}\!\left/ \!\raisebox{-1ex}{$64$}\right.\kern0.5em \)occlusion attack for the proposed algorithm on set-a, set-b and set-c respectively
Table 50 BER results after \( \raisebox{1ex}{$1$}\!\left/ \!\raisebox{-1ex}{$16$}\right.\kern0.5em \)occlusion attack for the proposed algorithm on set-a, set-b and set-c respectively
Table 51 BER results after \( \raisebox{1ex}{$1$}\!\left/ \!\raisebox{-1ex}{$4$}\right.\kern0.5em \)occlusion attack for the proposed algorithm on set-a, set-b and set-c respectively
Table 52 BER results after \( \raisebox{1ex}{$1$}\!\left/ \!\raisebox{-1ex}{$2$}\right.\kern0.5em \)occlusion attack for the proposed algorithm on set-a, set-b and set-c respectively
Table 53 BER results after \( \raisebox{1ex}{$3$}\!\left/ \!\raisebox{-1ex}{$4$}\right.\kern0.5em \)occlusion attack for the proposed algorithm on set-a, set-b and set-c respectively
Table 54 PSNR results, comparison results for \( \raisebox{1ex}{$1$}\!\left/ \!\raisebox{-1ex}{$64$}\right.,\raisebox{1ex}{$1$}\!\left/ \!\raisebox{-1ex}{$16$}\right.,\raisebox{1ex}{$1$}\!\left/ \!\raisebox{-1ex}{$4$}\right.,\raisebox{1ex}{$1$}\!\left/ \!\raisebox{-1ex}{$2$}\right.,\raisebox{1ex}{$3$}\!\left/ \!\raisebox{-1ex}{$4$}\right.\kern0.5em \)occlusion attack with techniques available in the literature on set-b
Table 55 BER results, comparison results for \( \raisebox{1ex}{$1$}\!\left/ \!\raisebox{-1ex}{$64$}\right.,\raisebox{1ex}{$1$}\!\left/ \!\raisebox{-1ex}{$16$}\right.,\raisebox{1ex}{$1$}\!\left/ \!\raisebox{-1ex}{$4$}\right.,\raisebox{1ex}{$1$}\!\left/ \!\raisebox{-1ex}{$2$}\right.,\raisebox{1ex}{$3$}\!\left/ \!\raisebox{-1ex}{$4$}\right.\kern0.5em \)occlusion attack with techniques available in the literature on set-b
Table 56 Various plots generated for encrypted image corrupted by \( \raisebox{1ex}{$1$}\!\left/ \!\raisebox{-1ex}{$64$}\right.,\raisebox{1ex}{$1$}\!\left/ \!\raisebox{-1ex}{$16$}\right.,\raisebox{1ex}{$1$}\!\left/ \!\raisebox{-1ex}{$4$}\right.,\raisebox{1ex}{$1$}\!\left/ \!\raisebox{-1ex}{$2$}\right.,\raisebox{1ex}{$3$}\!\left/ \!\raisebox{-1ex}{$4$}\right.\kern0.5em \)occlusion attack on set-b
Table 57 Crypto analysis attack results for chosen plaintext attack and known plaintext attack with techniques available in the literature on set-b

5.6.1 Brute force search time attack (BFST)

In this attack an attacker tries to use all permutation and combination of keys unless he gets the key that decrypts the encrypted image. This process takes a huge amount of time, due to which it this process is also known as exhaustive key search. Since the time is important to break any cipher image is relative to the span of the secret key in this we test the key size. [2, 3, 5, 8, 14, 16, 18, 21,22,23, 25,26,27, 31, 38,39,40, 45,46,47]. Table 32 shows the key space for the various techniques available in the literature techniques for the comparison. It can be seen that techniques based on quantum, chaos and qubit have a pretty good key space but the machine learning based techniques offers a very high amount of brute force search time due to the addition of network learnable parameters making it impossible to crack.

5.6.2 Noise attack (NA)

Encrypted data when sent through an open channel is highly vulnerable and even experience get noisy, that result in problem while decryption. The most common noise introduced to an image when passed through the noisy channel are salt & pepper, Poisson, Gaussian and speckle noise. An image encryption algorithm must with stand these types of noises so that information could be transferred properly. [27, 31, 46, 47]

In this attach the encrypted image is exposed to salt and pepper noise in order to test the robustness of the algorithm against noise, for this experiment a total of 10 % , 25%and 50% pixels of single plane are treated as the noise and noise is added to these pixels in all three planes of the encrypted image and finally decrypted. The results in Table 33 show how good the algorithm performed on such huge amount of channel added noise.

5.6.3 Geometrical attack (GA)

Geometrical Attack [31] is basically geometric distortion caused in an image intentionally or unintentionally, these may be due to rotation or flipping the original image. To test the algorithm against the known as de-synchronization attack various flip and rotation functions are applied on the encrypted image before sending it could be transmitted through the channel, a good algorithm is capable of recovering some portion of original input image at the receiver side this is because geometric distortion like these in an image make it difficult and sometimes impossible to identify the original data. Tables 44, 45, 46, 47, 48, 49, 50, 51, 52 and 53 shows the different flips and rotation attacks used for the experimentation.

Flip attack

In flip attack the encrypted image is flipped before transmitting, the different type of flip attacks can be seen in Table 44. The proposed algorithm withstands the flip attack and overpowers the available techniques in literature as seen in Tables 48 and 49 in term of PSNR and BER.

Rotation attack

In rotation attack the encrypted image is rotated before transmitting, the different rotation attacks can be seen in Table 41. Tables 42, 43 and 44 demonstrate BER and PSNR values for all the SETs of Dataset. The proposed algorithm is withstands the rotation attack and overpowers the available techniques in literature as seen in Tables 45 and 46 in term of PSNR and BER. Table 47 shows various plots generated for encrypted image corrupted by Rotation Attack on Set-C.

5.6.4 Anti-occlusion attack (AOA)

To analyse the anti-occlusion [31, 46] capability of the proposed algorithm against the loss of data, the same encrypted image is occluded with\( \raisebox{1ex}{$1$}\!\left/ \!\raisebox{-1ex}{$64$}\right.,\raisebox{1ex}{$1$}\!\left/ \!\raisebox{-1ex}{$16$}\right.,\raisebox{1ex}{$1$}\!\left/ \!\raisebox{-1ex}{$4$}\right.,\raisebox{1ex}{$1$}\!\left/ \!\raisebox{-1ex}{$2$}\right.\&\raisebox{1ex}{$3$}\!\left/ \!\raisebox{-1ex}{$4$}\right. \)respectively. Then, the blocked images are decrypted with the algorithm with which it is encrypted. This attack is usually done to test the algorithms performance when there is some loss in the data, to carry out this test \( \raisebox{1ex}{$1$}\!\left/ \!\raisebox{-1ex}{$64$}\right.,\raisebox{1ex}{$1$}\!\left/ \!\raisebox{-1ex}{$16$}\right.,\raisebox{1ex}{$1$}\!\left/ \!\raisebox{-1ex}{$4$}\right.,\raisebox{1ex}{$1$}\!\left/ \!\raisebox{-1ex}{$2$}\right.,\raisebox{1ex}{$3$}\!\left/ \!\raisebox{-1ex}{$4$}\right.\kern0.5em \) occlusion schemes are used as shown in Table 48. The Tables 54, 55 and 56 does comparison on the basis of PSNR and BER with available techniques in literature. It can be seen in Table 56 that the algorithm is able to recover data from all the occlusion encrypted images.

From the results is can be seen that our proposed technique performs perfectly for \( \raisebox{1ex}{$\mathbf{1}$}\!\left/ \!\raisebox{-1ex}{$\mathbf{64}$}\right.,\raisebox{1ex}{$\mathbf{1}$}\!\left/ \!\raisebox{-1ex}{$\mathbf{1}\mathbf{6}$}\right.,\raisebox{1ex}{$\mathbf{1}$}\!\left/ \!\raisebox{-1ex}{$\mathbf{4}$}\right.,\raisebox{1ex}{$\mathbf{1}$}\!\left/ \!\raisebox{-1ex}{$\mathbf{2}$}\right.,\raisebox{1ex}{$\mathbf{3}$}\!\left/ \!\raisebox{-1ex}{$\mathbf{4}$}\right.\kern0.5em \) occluded part in the encrypted image as shown in Table 49, 50, 51, 52 and 53.

5.6.5 Crypto analysis (CA)

The cipher text only attack is an attack which is used for cryptanalysis where it is assumed that the unauthorized user have access to the cipher text. The cryptography fails to resist the attack if the plaintext or key is obtained. [14, 31]. Table 57 depicts the cryptanalysis results of the of different techniques available literature on Chosen Plaintext Attack and Known plaintext Attack. Although out of these attacks, the chosen plaintext attack is the most threatening. As crypto analysis is the analysis and deciphering of cryptographic schemes, the cipher text attack is used for cryptanalysis, here it is assumed that the hacker have access to the cipher text. If the hacker does not get the key or plain text it is assumed that the cryptography passed to resist the attack. The other common cryptanalysis attack is known plaintext attack, where the hacker user has plaintext and the encrypted text to discover the key or text. The results show the proposed image encryption scheme is capable of resisting both the attacks.

5.7 Randomness test analysis (RTA)

This analysis helps to get an idea of the random nature of a PRNG. The results are computed using the NIST SP 800–22, Chi-Square Test and Runs Test on a highly randomized series generated by the GAN based PRNG. The results of the following test are shown in Tables 58, 59 and 60 respectively.

Table 58 NIST SP 800–22 test suit results for randomness test
Table 59 Chi-square test results for randomness test
Table 60 Runs test results for randomness test

5.7.1 NIST SP 800–22

NIST SP 800–22A [19, 37] is basically a statistical test suite that is used for the analysis of random and pseudorandom number generators. It checks for the randomness of the algorithm. The proposed GAN based PRNG passes the NIST SP 800–22 test as shown in Table 58, from the results we can deduce that the training results of low-dimensional chaotic system are capable of passing the NIST test when the chaotic sequence is used as the training set.

5.7.2 Chi-square test (CST)

Chi-square test is basically used to check the regularity between the original image and the encrypted image. Lower is the chi-square value; the better is the consistency, resulting in superior degree of the encryption effect. [31] The proposed GAN based PRNG passes the Chi-Square test as shown in Table 59. This means the series generated by the proposed PRNG are highly randomized and exhibits highly random nature.

5.7.3 Runs test (RT)

A runs test is a statistical test, also known as the Wald–Wolfowitz runs test that examines if data is occurring randomly or not, where a run is defined as a series of increasing values or a series of decreasing values. The proposed GAN based PRNG passes the Runs test as Zstatistic < Zcritical where the value of Zstatistic = 0.5700002850004988 and Zcritical = 1.96 as shown in Table 60. This means the series generated by the proposed PRNG are highly randomized and exhibits highly random nature.

6 Comparison with other state-of-the-art algorithms

The results in Table 61 show that the proposed scheme overpowers renowned mechanisms in terms of Visual Analysis, Statistical Analysis, Quantitative Analysis (H, SSIM, and BER), Differential Attack Analysis, Other Attack Analysis and Randomness Test Analysis.

Table 61 Comparison table with other state-of-the-art algorithms

7 Conclusion

In this paper, a highly secure cryptography mechanism is proposed that accomplishes protection by employing a series of specially designed substitution boxes, permutation boxes, and diffusion boxes. It takes encryption keys as input, generated from a Generative Adversarial Network (GAN), an unsupervised deep learning algorithm trained on the Logistic Maps. It can be concluded from the experimental results that the proposed image encryption scheme outperforms state-of-the-art methods with better performance in all aspects. Since the trained generator passed the NIST test suite, chi-square test, and runs test. Further, it also withstands most of the probable attacks available in the literature; the algorithm even offered the promising average of MSE, PSNR, BER, SSIM, H, CC, NPCR, and UACI. The proposed algorithm provides a very high amount of brute force search time due to using a deep learning algorithm and performing operations at bit-level and byte-level. It also meets essentially all of the conditions that a good image encryption algorithm entails, which are listed as follows:

  • The proposed scheme employs GAN an unsupervised deep learning based robust image encryption technique.

  • The projected algorithm shows very high key randomness.

  • The proposed scheme offers a very high key space.

  • The given scheme offers byte level operations at substitution stage, and both byte level and bit level operations at the permutation and diffusion stages.

  • The scheme offers a very high key sensitive mechanism for the generation of random numbers.

8 Motivation, applications and future scope

This Research aims the development of a robust image encryption scheme based on an unsupervised deep learning algorithm and multilevel encryption technique, which can withstand against wide range of attacks. Table 62 shows the list of papers from which this research is motivated.

Table 62 Motivation

From the research conducted in this paper it can be deduced that, a deep neural network can be trained on less random sequences, and can be used as a highly randomized PRNG for creating unpredictable and extremely random sequences. These neural networks based PRNGs can be utilized for various applications such as image encryption mechanisms for securing image data, hybrid security algorithms to store text data at random locations in an image, gaming applications where highly randomized behaviour is required and generating random captchas for online authentication etc. With advancement in cybercrime it is also required to search new ways to counter these advancements. Employment of machine learning and deep learning techniques can reduces this advancement. This opens the door for further research in field of encryption to secure data.