An Image Encryption Scheme Based on Block Scrambling, Modified Zigzag Transformation and Key Generation Using Enhanced Logistic—Tent Map

Nowadays, the images are transferred through open channels that are subject to potential attacks, so the exchange of image data requires additional security in many fields, such as medical, military, banking, etc. The security factors are essential in preventing the system from brute force and differential attacks. We propose an Enhanced Logistic Map (ELM) while using chaotic maps and simple encryption techniques, such as block scrambling, modified zigzag transformation for encryption phases, including permutation, diffusion, and key stream generation to withstand the attacks. The results of encryption are evaluated while using the histogram, correlation analysis, Number of Pixel Change Rate (NPCR), Unified Average Change Intensity (UACI), Peak-Signal-to-Noise Ratio (PSNR), and entropy. Our results demonstrate the security, reliability, efficiency, and flexibility of the proposed method.


Introduction
With rapid spread of cloud computing, mobile networks, internet of things, and social networking, the issue of secure transmission of image data has become increasingly relevant [1,2]. Encrypting secret information that is sent over Internet or wireless networks as multimedia is important in satisfying the need of a secure route of data transmission over various communications channels. Averting unapproved access, adjustment, or the destruction of data ought to anchor the data exchanged through these channels. Different types of data are transmitted over the channels, for example, text, images, audio, video, three-dimensional (3D), and others for many domains of application, such as military, medical, financial institutions, etc. However, the security of those images is a challenge. The critical part of exchanging images is security, in order to protect the image from unauthorized access and modification.
The utilization of cryptographic strategies for image encryption is especially required in order to provide a powerful solution to the security of images. The cryptographic strategies convert the image into an irrelevant data sequence that cannot be effortlessly broken by the attacker. The target of image encryption is to provide high security and avoid unauthorized access. Standard cryptography techniques, such as Advanced Encryption Standard (AES), are regularly applied for text messages. still has some limitations, such as discontinuity, numerical degradation, non-consistency, and weak key space [46], which thus motivates the need for MD maps, such as a3D mixed chaotic map [47]. Articles [48,49] suggested the intertwining of the logistic maps to strengthen the security and to enhance pseudo-randomness and increase the key space.
Here, we propose a novel key generation algorithm that uses block scrambling, modified zigzag transformation, and enhanced logistic-tent map for image encryption. The current work extends we work of Li et al. [50], by suggesting the use of Enhanced Logistic-Tent Map (ELTM) instead of 3D logistic map to obtain better encryption characteristics. The principal contribution of the paper is the proposed key generation algorithm using ELM, which provides high security, as it takes plain image and key for each iteration of key generation. Here, a new efficient ELTM bases algorithm is proposed. The statistical test analysis is done by the National Institute of Standards and Technology (NIST) statistical test suite demonstrates its better security characteristics.
The remaining parts of the paper are as follows. We describe the methods used in Section 2. In Section 3, the results are presented. In Section 4, the NIST statistical test suite results are given. Finally, we summarize our results and present the conclusions in Section 5.

Logistic Map
Chaotic maps are highly sensitive to the initial value, which makes them unpredictable. A change in the numerical sequence that is generated by the function can occur, even if a minor change in the initial value is executed [51]. Different forms of chaotic maps are used; however, the logistic map is perhaps the most known map and is defined in Equation (1) [13], as follows: here T n is the state, r is the behavior parameter, and n is the count of iterations used to generate the state values iteratively. This 1D logistic map can be extended to a three-dimensional (3D) one, as indicated in Equation (2) [52].

Skew Tent Map
The skew tent map is represented by the nonlinear equation [52]: here T n ∈ [0, 1] is the state, c ∈ [0, 0.5] ∪ [0.5, 1] is the behaviour parameter, and n is the count of permutations that are used to create state values iteratively.

Block Scrambling
First, the RGB image, which has the dimension of 256 × 256 × 3 is segregated into four quadrants. Subsequently, each quadrant is further segregated into four sub-quadrants, while each sub-quadrant is rotated anti-clockwise by 90 • to form 64 sub-blocks. While this procedure scrambles the image, it does not fully remove the associations between the nearby pixels.

Modified Zigzag Transformation
Zigzag Transformation (ZT) is a procedure to have an image scrambled [53]. The red, green, and blue image channels are treated as separate matrices having the size of 256 × 256 pixels. In ZT, the upper left pixel is shifted to one side, which allows for the attacker to crack the strategy. In the modified ZT, the upper left and next horizontal neighboring pixels are exchanged with the base right pixel.
The change is performed to the pixels of every matrix, starting from the upper left corner and ending with the base right corner to execute encryption. The first and the second elements of the matrix are moved to the last and one-before-last position of the matrix, and the remaining elements are swapped in a zigzag way.
The first and second elements of the matrix are moved to the last and the one-before-last elements of the matrix and the remaining elements of the matrix are swapped in a zigzag way to execute decryption. The change is connected to the pixels of every framework as delineated. This strategy totally twists the relationship among the nearby pixels of the image, which results in the modified ZT of the image.

Enhanced Logistic Map (ELM)
The proposed Enhanced Logistic Map (ELM) enhances the security of the scheme by employing the chaotic diffusion method. The ELM is 3D, as it separately deals with RGB of the color image. The ELM is defined, as follows: where, λ, β, α, c are the constants, 0.8 < λ < 2.60, 0 < β < 0.15, 0.42 < α < 0.85, 0 < c < 0.35. The range of all λ, β, α, c are greater than the 3D logistic map, thus it provides better security than the 3D logistic map. The bifurcation diagram and the Lyapunov Exponent of ELM are shown in Figures 1  and 2, respectively.

Key Generation
Both encryption and decryption processes use the same key.
As a result, the generated key depends on the image and EX-OR operation is executed with each value of , , .
R G B

Encryption Algorithm
The proposed framework can be used for any M M  color image. Encryption has two parts: confusion and diffusion. Blocks scrambling is used to obtain 64 squares when confusion is performed. Finally, the modified ZT is performed to remove the association between the adjacent pixels. Key

Key Generation
Both encryption and decryption processes use the same key.
The cryptosystem is secured with the plain image, the novel proposed system employs a 256-bit key (K), which has 192-bit data calculated from ELM, the secret key (K e ), and 64-bit data chosen by the user from a plain image (K d ). K d retains pixels R r i , r j , G g i , g j , B b i , b j , which are selected by the encoder. Now, K = K e K d , where the key K is segregated into 16-bit parts ks 1 , ks 2 . . . ks 16 .
The initial condition I c , the parameter P x and the iteration count n of the skew tent system are defined by the following equations: I c = ks 2 ⊕ ks 4 ⊕ · · · ⊕ ks 14 ⊕ ks 16 )/256 P x = ks 1 ⊕ ks 3 ⊕ · · · ⊕ ks 9 ⊕ ks 11 ) + ks 13 + ks 15 )/758 n = (ks 14 ⊕ ks 15 ) + ks 16 (6) As a result, the generated key depends on the image and EX-OR operation is executed with each value of R, G, B.

Encryption Algorithm
The proposed framework can be used for any M × M color image. Encryption has two parts: confusion and diffusion. Blocks scrambling is used to obtain 64 squares when confusion is performed. Finally, the modified ZT is performed to remove the association between the adjacent pixels. Key generation executed while using the 3D ELM to produce secret keys in the range 0-255 for every X, Y, and Z. In the final step, the EX-OR operation is executed to obtain the cipher image.
Algorithm 1 summarizes the algorithm of encryption. Step 1: Block scrambling is applied on P, which is split into 64 blocks each of size 32 × 32 represented as C 1 .
Step 2: Modified zigzag transform (ZT) is performed on the scrambled blocks C 1 to obtain C 2 .
Step 3: C 2 is split into RGB channels each of size 256 × 256.
Step 4: Using ELM, the intermediate key is generated with initial values are taken as Step 5: The final key is generated by applying the chosen values from image and external user as initial condition and parameters.
Step 6: The secret key K is EX-OR-ed with the RGB channels received after modified ZT to obtain C. Figure 3 presents the block diagram for the encryption procedure. The decryption process is performed in reverse of encryption to obtain plain image P.
Entropy 2019, 21, x 6 of 17 generation executed while using the 3D ELM to produce secret keys in the range 0-255 for every X, Y, and Z. In the final step, the EX-OR operation is executed to obtain the cipher image. Algorithm 1 summarizes the algorithm of encryption. Algorithm 1. Algorithm of the encryption process.

Algorithm 1: Encryption
Input: plain color image P of size 256 256  Output: cipher image C Step 1: Block scrambling is applied on P , which is split into 64 blocks each of size 32x32 represented as 1 C .
Step 2: Modified zigzag transform (ZT) is performed on the scrambled blocks 1 C to obtain 2 C .
Step 3: 2 C is split into RGB channels each of size 256 256  .
Step 4: Using ELM, the intermediate key is generated with initial values are taken Step 5: The final key is generated by applying the chosen values from image and external user as initial condition and parameters.
Step 6: The secret key K is EX-OR-ed with the RGB channels received after modified ZT to obtain C . Figure 3 presents the block diagram for the encryption procedure. The decryption process is performed in reverse of encryption to obtain plain image P .

Evaluation
We assess the security characteristics of the proposed scheme while using histogram analysis, information entropy analysis, correlation coefficient, Number of Pixels Change Rate (NPCR), Unified Average Change Intensity (UACI), Mean Square Error (MSE), and Peak Signal to Noise Ratio (PSNR).

Key Space Analysis
The proposed method is heavily dependent on the key, it should ensure that the key is secure, and that the key space should be adequately large to make the brute force attack impossible. As the proposed algorithm uses a 256-bit key, the number of admissible secret key combinations is 2 256 for R, G, and B separately, making it quite difficult to break while using brute force.

Evaluation
We assess the security characteristics of the proposed scheme while using histogram analysis, information entropy analysis, correlation coefficient, Number of Pixels Change Rate (NPCR), Unified Average Change Intensity (UACI), Mean Square Error (MSE), and Peak Signal to Noise Ratio (PSNR).

Key Space Analysis
The proposed method is heavily dependent on the key, it should ensure that the key is secure, and that the key space should be adequately large to make the brute force attack impossible. As the proposed algorithm uses a 256-bit key, the number of admissible secret key combinations is 2 256 for R, G, and B separately, making it quite difficult to break while using brute force.

Key Sensitivity Analysis
The good encryption method must be very sensitive to changes in the keys. Implementing a small change to the encryption key, the output image must be very different when compared to the unmodified encrypted image.

Histogram Analysis
The histogram represents the distribution of pixel values in an image. An encrypted image is expected to have a uniform distribution of the histogram values, making for the attacker difficult to learn something about the image. Thus, the suitability of the proposed encryption method is shown by the uniform distribution of pixel values in a coded image.

Correlation Coefficient Analysis
Usually, the neighboring pixels of the plain image are related, while the adjacent pixels of the encrypted image are weakly correlated, which suggests that there are no associations between them.
Correlation Coefficient Analysis (CCA) is performed to assess the level of similarity between the pair of pixels. This involves the calculation and assessment of the Pearson correlation coefficient alongside the vertical, horizontal, and diagonal directions of both the plain and encrypted image.
A good encryption method should break the correlation between adjacent pixels. The less the correlation is, the more effectively the method performs. The correlation coefficient is calculated, as follows: here X and Y are the pixels and neighboring pixels of the original and encrypted image, cov(X, Y) is the covariance between X and Y, D(X) is variance of X, and E(X) is the expected value of X.

NPCR and UACI Analysis
Number of Pixels Change Rate (NPCR) assesses the pixel difference between the original and encrypted images [54,55], as follows: here D(i, j) is calculated as Higher randomization of the pixel values leads to a larger value of NPCR. The Unified Average Changing Index (UACI) assesses the mean intensity of differences between the original image and encrypted image [56,57], as follows: here P(i, j) and C(i, j) are pixel values of the original and encrypted images, and L is the largest pixel value of both images. The values of both NPCR and UACI indicate the resistance of the encryption method against the differential attack. Information entropy assesses uncertainty of a random variable, as follows [56]: here P(i) is the probability of the presence of pixel i. A larger entropy value indicates a greater level of security when applied to evaluate image encryption. Usually, an entropy value that is very close to a perfect value of 8 is considered to be safe from a brute force attack.

PSNR Analysis
The Peak-Signal-to-Noise Ratio (PSNR) can be used to assess the quality of an image. A good image encryption method is expected to produce encrypted images with a low value of PSNR. Mathematically, PSNR is calculated by: where P(i, j) is pixel value of the original image, and C(i, j) is pixel value of the encoded image, and Mean Square Error (MSE) is calculated as:

Settings
All of the simulations were performed on a desktop computer with Intel ®Core™ i5-2430M CPU 2.4GHZ Processor, 4GB RAM, and Windows 8 Professional operating system. We used the freely available images from the USC-SIPI image dataset, such as Baboon, Plane, Lena, and Peppers, as the original protected images (see Figure 4). Figure 5 shows the encrypted images.
pixel value of both images.
The values of both NPCR and UACI indicate the resistance of the encryption method against the differential attack.

Information Entropy Analysis
Information entropy assesses uncertainty of a random variable, as follows [56]: here   P i is the probability of the presence of pixel i .
A larger entropy value indicates a greater level of security when applied to evaluate image encryption. Usually, an entropy value that is very close to a perfect value of 8 is considered to be safe from a brute force attack.

PSNR Analysis
The Peak-Signal-to-Noise Ratio (PSNR) can be used to assess the quality of an image. A good image encryption method is expected to produce encrypted images with a low value of PSNR. Mathematically, PSNR is calculated by: where  

Settings
All of the simulations were performed on a desktop computer with Intel ® Core™ i5-2430M CPU 2.4GHZ Processor, 4GB RAM, and Windows 8 Professional operating system. We used the freely available images from the USC-SIPI image dataset, such as Baboon, Plane, Lena, and Peppers, as the original protected images (see Figure 4). Figure 5 shows the encrypted images.

Results
Standard techniques and tests are recommended for evaluating the results [51][52][53]. The quality of the proposed encoding method is indicated by the uniform distribution of pixel values in an encrypted image while using the histogram analysis method. As an example, see a histogram of the Peppers image for red (R), green (G), and blue (B) channels in Figure 6a-c. Figure 6d-f presents the RGB channels of the encrypted Peppers image. Here, the uniform distribution indicates that it would be difficult for the attacker to decipher the data.

Results
Standard techniques and tests are recommended for evaluating the results [51][52][53]. The quality of the proposed encoding method is indicated by the uniform distribution of pixel values in an encrypted image while using the histogram analysis method. As an example, see a histogram of the Peppers image for red (R), green (G), and blue (B) channels in Figure 6a-c. Figure 6d-f presents the RGB channels of the encrypted Peppers image. Here, the uniform distribution indicates that it would be difficult for the attacker to decipher the data.

Results
Standard techniques and tests are recommended for evaluating the results [51][52][53]. The quality of the proposed encoding method is indicated by the uniform distribution of pixel values in an encrypted image while using the histogram analysis method. As an example, see a histogram of the Peppers image for red (R), green (G), and blue (B) channels in Figure 6a-c. Figure 6d-f presents the RGB channels of the encrypted Peppers image. Here, the uniform distribution indicates that it would be difficult for the attacker to decipher the data. It will not be possible to reconstruct the enciphered image if the keys differ by a small value [23]. As an example, Figure 7 shows the reconstructed images with a minor change of the secret key from 0 0.790 X  to 0 0.791 X  , leading to totally different images.  The scattered graph can show the correlations between the neighboring image pixels. 1000 random neighboring pixels from an image are used to show the relationship. As an example, Figure  8a-c demonstrates a strong correlation between adjoining pixels, along horizontal, vertical, and diagonal neighboring pixels in the Peppers plain image. However, the correlation between the neighboring pixels is weak for an encrypted Pepper image (see Figure 8d-f). It will not be possible to reconstruct the enciphered image if the keys differ by a small value [23]. As an example, Figure 7 shows the reconstructed images with a minor change of the secret key from X 0 = 0.790 to X 0 = 0.791, leading to totally different images. It will not be possible to reconstruct the enciphered image if the keys differ by a small value [23]. As an example, Figure 7 shows the reconstructed images with a minor change of the secret key from 0 0.790 X  to 0 0.791 X  , leading to totally different images.  The scattered graph can show the correlations between the neighboring image pixels. 1000 random neighboring pixels from an image are used to show the relationship. As an example, Figure  8a-c demonstrates a strong correlation between adjoining pixels, along horizontal, vertical, and diagonal neighboring pixels in the Peppers plain image. However, the correlation between the neighboring pixels is weak for an encrypted Pepper image (see Figure 8d-f). The scattered graph can show the correlations between the neighboring image pixels. 1000 random neighboring pixels from an image are used to show the relationship. As an example, Figure 8a-c demonstrates a strong correlation between adjoining pixels, along horizontal, vertical, and diagonal neighboring pixels in the Peppers plain image. However, the correlation between the neighboring pixels is weak for an encrypted Pepper image (see Figure 8d The correlation values for plain and encrypted images are given in Table 1 for the Lena, Peppers, Barbara, and Baboon images, along the horizontal, vertical and diagonal directions.  Table 2 presents the results of NPCR and UACI, PSNR, and Entropy. The values of NPCR and UACI demonstrate that the algorithm is very resistive against differential attack. The entropy is quite close to a perfect value of 8, and demonstrates that the proposed encryption method randomized the pixels in the encrypted image well. The obtained PSNR values are low, hence they also show that the proposed algorithm is good. The proposed method is compared with other methods, while using entropy, NPCR, UACI, and correlation analysis for the Lena image of size 256 × 256 in Table 3. Here, we compare our method with other methods that were proposed by Li   The correlation values for plain and encrypted images are given in Table 1 for the Lena, Peppers, Barbara, and Baboon images, along the horizontal, vertical and diagonal directions.  Table 2 presents the results of NPCR and UACI, PSNR, and Entropy. The values of NPCR and UACI demonstrate that the algorithm is very resistive against differential attack. The entropy is quite close to a perfect value of 8, and demonstrates that the proposed encryption method randomized the pixels in the encrypted image well. The obtained PSNR values are low, hence they also show that the proposed algorithm is good. The proposed method is compared with other methods, while using entropy, NPCR, UACI, and correlation analysis for the Lena image of size 256 × 256 in Table 3. Here, we compare our method with other methods that were proposed by Li et al. [50] by Zhang et al. [27], Xu et al. [58], Wang et al. [59], Liu and Wang [60], Hussain et al. [61], Wang and Zhang [62], and Ahmad et al. [56]. In an occlusion attack, the enciphered image, which is transmitted over communication channels, could lose blocks of information. The robustness of the proposed algorithm against 12.5%, 25%, and 50% of occlusion in an encrypted image is evaluated while using MSE. The resulting MSE values are 1542.8362 for 12.5%, 3214.7971 for 25%, and 6927.9417 for 50% occlusion. We can claim that the proposed method can resist an occlusion attack, as the deciphered image still can be retrieved.
Following the suggestion of Askar et al. [63], the original images are corrupted by adding Gaussian noise with the mean of 0 and variance of 0.001, as well as with salt and pepper noise with the density of 0.05. Figure 9 shows the obtained deciphered images. To compare, Table 4 shows the MSE and PSNR values. Based on Table 4, it can be concluded that the proposed method is resistant to salt and pepper noise, since the PSNR value exceeded 58 dB.  In an occlusion attack, the enciphered image, which is transmitted over communication channels, could lose blocks of information. The robustness of the proposed algorithm against 12.5%, 25%, and 50% of occlusion in an encrypted image is evaluated while using MSE. The resulting MSE values are 1542.8362 for 12.5%, 3214.7971 for 25%, and 6927.9417 for 50% occlusion. We can claim that the proposed method can resist an occlusion attack, as the deciphered image still can be retrieved.
Following the suggestion of Askar et al. [63], the original images are corrupted by adding Gaussian noise with the mean of 0 and variance of 0.001, as well as with salt and pepper noise with the density of 0.05. Figure 9 shows the obtained deciphered images. To compare, Table 4      The Tang's algorithm [64], Zhang's algorithm [65], and Karawia's algorithm [66] were compared for the computational performance analysis. The results are shown in Figure 10 for the same set of four images, and they demonstrate that the proposed algorithm is computationally more efficient.

Statistical Test Analysis
The NIST statistical test suite (version 2.1.1, National Institute of Standards and Technology, Gaithersburg, MD, USA) [67] was used to evaluate the randomness of the bit sequence that was produced by the proposed system. The suite involves 15 tests, which assess the randomness that might occur in a series. Table 5 presents the results. Table 5 indicates that the NIST test is effectively performed: all p−values among 1000 sequences used for testing are evenly distributed in the 10 subintervals, while the pass rate is also acceptable. The average pass rate is 99.1% with a minimum pass rate of 98.4%.

Statistical Test Analysis
The NIST statistical test suite (version 2.1.1, National Institute of Standards and Technology, Gaithersburg, MD, USA) [67] was used to evaluate the randomness of the bit sequence that was produced by the proposed system. The suite involves 15 tests, which assess the randomness that might occur in a series. Table 5 presents the results. Table 5 indicates that the NIST test is effectively performed: all p−values among 1000 sequences used for testing are evenly distributed in the 10 subintervals, while the pass rate is also acceptable. The average pass rate is 99.1% with a minimum pass rate of 98.4%.

Conclusions
We introduced an image encryption method that is based on a chaotic map with a new symmetric key generation system. The scheme uses Block Scrambling and Modified Zigzag Transformation, while key generation is performed using the enhanced logistic-tent map. Confusion and diffusion are achieved by pixel shuffling. It provides priority to resisting the brute-force attack to the suggested algorithm. The experimental results revealed that the suggested method has generated the encrypted images with uniform distribution in pixel histograms. Moreover, the suggested algorithm has shown that the encrypted pictures have information entropy of close to 8. It is able to robustly resist chosen/known plaintext attacks, is robust to salt and pepper noise, and it can withstand up to 50 percent occlusion attack. The comparison experiments were performed with other recent algorithms. The results of the statistical testing indicate that the new pseudo-random bit combiner can provide file encryption/decryption safety. We claim that the method is secure and computationally efficient based on the analysis of the proposed method. The proposed algorithm is simple, fast, and has strong practical application value.