Secure and Fast Image Encryption Algorithm Based on Modified Logistic Map

: In the past few decades, the transmission of data over an unsecure channel has resulted in an increased rate of hacking. The requirement to make multimedia data more secure is increasing day by day. Numerous algorithms have been developed to improve efficiency and robustness in the encryption process. In this article, a novel and secure image encryption algorithm is presented. It is based on a modified chaotic logistic map (CLM) that provides the advantage of taking less computational time to encrypt an input image. The encryption algorithm is based on Shannon’s idea of using a substitution–permutation and one-time pad network to achieve ideal secrecy. The CLM is used for substitution and permutation to improve randomness and increase dependency on the encryption key. Various statistical tests are conducted, such as keyspace analysis, complexity analysis, sensitivity analysis, strict avalanche criteria (SAC), histogram analysis, entropy analysis, mean of absolute deviation (MAD) analysis, correlation analysis, contrast analysis and homogeneity, to give a comparative analysis of the proposed algorithm and verify its security. As a result of various statistical tests, it is evident that the proposed algorithm is more efficient and robust as compared to previous ones.


Introduction
In recent years, the multimedia and communications industry has been developing at a rapid pace.Many large streams of multimedia data are transmitted over an unsecure channel.As the rate of hacking has increased with the passage of time, the security of the data must be increased rapidly [1].Numerous algorithms have been developed that are efficient and robust, but are still not sufficient to protect data to a desired level.In addition, less computationally complex algorithms are required to cater to the need to secure highspeed data transmissions.A lossless, novel and secure image encryption algorithm based on the modified chaotic logistic map (CLM) that takes less computational time for encryption is presented in this article.The results presented in this article demonstrate the following contributions, as depicted by the proposed image encryption algorithm.

•
The proposed image encryption method gives a less computationally complex arrangement of the encryption/decryption process, making it lightweight without compromising on the security of the algorithm.

•
The key used in the algorithm is the population growth of the modified chaotic logistic map.The keyspace is enhanced in comparison with the original chaotic logistic map.• One-time substitution is performed in the proposed algorithm, which provides good SAC as compared to classical techniques.

•
Various statistical and visual tests prove its resistance to linear and differential attacks.
According to Shannon [2], an ideal secrecy can be achieved if and only if an encryption method essentially contains substitution and permutation processes.After thorough testing, we discover that the histogram is not evenly distributed using only one-time substitution and permutation.Therefore, a stream of pseudorandom numbers from the CLM is XORed to achieve the required result.

Motivation
In order to facilitate the requirements and security of high-speed data transmissions, an image encryption algorithm is required, which is The CLM has many great features, such as sensitive dependence on initial conditions, random orbit, pseudorandomness, good ergodicity, better cross-correlation properties, high efficiency, better mixing properties and a large keyspace.These features also makes the CLM a potential candidate in quantum image encryption algorithms and is therefore quantum-safe [3][4][5].The CLM also has a low computational cost, requires simpler hardware and is easy to implement [6].It is verified that the CLM is capable of providing high-speed image encryption at a low cost [7].
A good encryption scheme must have a substitution-permutation (SP) network as indicated by C. E. Shanon [2] to increase the security [8].Pixel-level substitution and permutation are used in the algorithm to save computation time and cost.Otherwise, if bit-level substitution and permutation are used, then the algorithm's computation time and cost increase eight times.

Image Encryption Techniques Based on Permutation
Permutation is the property used for the rearrangement of pixels in some pseudorandom order.It means that several pixels of the encrypted image are affected by just changing one pixel of the original image.Therefore, it hides any dependency between the input image and the encrypted image [9].An algorithm becomes more resistant to frequency analysis attacks by using permutation techniques.The permutation techniques are further classified into two categories: one is pixel-level permutation and the second is bit-level permutation.These permutations are achieved by employing various transforms [10,11], chaotic maps [12][13][14][15][16][17], cyclic shifts [18][19][20][21], hash functions [22], sorting techniques [15,[23][24][25][26][27] and parallel computing [28].Although, these transformational-technique-based algorithms have many flaws, one of them is that they create high security but increase time complexity, which further results in lengthy preprocessing and poor permutation performance.On the other hand, sorting-based permutation techniques give the best permutation effect, but the time complexity increases and memory cost becomes high.If cyclic shift permutation techniques are utilized, they reduce the computational complexity and reduce memory costs but weaken the permutation effect.There is a need for a secure encryption algorithm, which reduces the time complexity and memory cost, though not at the cost of a reduction in the security.
Anees et al. [35] proposed a technique that implements three S-boxes for the substitution.However, it is proved that this technique is better than the classical techniques and lacks permutation capabilities.Arif et al. [36] proposed an encryption-technique-based chaotic logistic map, employing a hashing algorithm and AES S-boxes.Various statistical tests are performed and it is shown that their encryption technique is lightweight and efficient.Alawida [c] [37] proposed a technique for image encryption, which is based on permutation and double substitution.It is proved in this study that permutation and substitution alone cannot uniformly distribute the information of the input image in the encrypted image.

Image Encryption Techniques Based on Transformations
Image encryption can be lossy or lossless [38].Various transformation techniques that are used for image encryption are lossy [10,11].In the proposed algorithm, we employ a CLM because of its high dependency on initial conditions.A novel and secure image encryption algorithm based on a CLM that requires less computational time to encrypt an original image is presented.Shannon's idea of using a substitution-permutation and one-time pad network to achieve ideal secrecy is the backbone of this research [2].

Objectives of the Research
An image encryption technique is presented, which is lossless, takes less time to encrypt/decrypt, has a low cost and is less computationally complex.The presented image encryption technique has achieved all of the above attributes, which is quantitatively proved under the results in Section 4.

Organization of the Paper
The rest of the paper is organized as follows: The proposed image encryption algorithm is presented in Section 2. The proposed algorithm's pseudocode is given in Section 3. The results along with statistical tests are presented in Section 4. The conclusion of the research is presented in Section 5.

Proposed Algorithm
The encryption process is divided into six stages.A block diagram is given in Figure 1.In the first stage, the permutations on the grayscale image are performed.The second stage involves the substitution of pixel intensities of the permuted grayscale image.The pixel intensities are then converted into binary bits in the third stage.In the fourth stage, the random binary bits are collected from the CLM.In the fifth stage, the binary bits from stage three and four are added using an "XOR" operation.In the last and final stage, the resultant bits are converted into pixel intensities.The flowchart of the encryption process is given in Figure 2. The details of the six stages are presented as follows:

Permutation
The permutation process rearranges pixel intensities according to a sequence acquired from the CLM.For example, if a permutation matrix [2,4,1,3] obtained from a CLM with population growth is applied to numbers 2, 4, 1, 3 (pixel intensities), the resultant sequence after permutation is 4, 3, 2, 1.In an image, all the input pixels are shuffled in a random manner.In the proposed algorithm, the new rows and columns of the substituted image are computed by using the CLM, and the population growth is a part of its key.

Chaotic Logistic Map
The logistic map was first applied by Lorenz [39].The governing equation for the logistic map is as follows: where γ is the population growth of the logistic map.For the logistic map to be chaotic, its population growth must lie between 3.6 and 4. The proposed algorithm requires a unique combination of 256 numbers.Therefore, through extensive testing, it is determined that the numbers from [0, 255] arranged in ascending order are permuted with the help of the CLM.
In order to obtain a unique combination, it is necessary for the population growth of the logistic map to be equal to 0.5, 1.5, 2.5, 3.5, 4.5, .....Only on these values can we achieve a unique and random combination of numbers in the range [0, 255].Therefore, the equation is modified and can be rewritten as follows: where γ ∈ Z + is a set of positive integers.Equation ( 1) is used for the addition of pseudorandom bits in the substituted and permuted image.Equation ( 2) is used solely for the purpose of substitution and permutation.The bifurcation diagram of Equation ( 2) is given by Figure 3.

Behavior of the Modified CLM
The modified equation presented in this research enhances the security of the CLM and reduces the computational cost.In the proposed algorithm, a unique combination of 256 pixels is needed in order to carry out the substitution.Therefore, Equation ( 2) is used to obtain as many samples as needed.Through extensive testing, it is found that it has 256! distinct combinations.This modified CLM is then again utilized in permutation, which is explained in the current section.At this point, it has (256 × 256)! distinct combinations.In Section 2.5, a simple CLM is used.The keyspace provided by the CLM is more than 2 302 [40].All of these cascaded CLMs provide a huge keyspace while maintaining a low computational cost, which is the major achievement of this research.
We permute the arrangement of rows and columns.Consider an image of Lena (256 × 256).(The image and histogram are shown in Figure 4).Its permuted image and its histogram are shown in Figure 5.It is evident from both histograms (which are identical) that pixels are shuffled in such a manner that the permuted image is not depicting any resemblance with the original image.

Substitution
Substitution is a process in encryption where the bits from the original message are substituted with pseudorandom bits.It is used to obscure the relationship between the pixels of the input image and the corresponding pixels of the encrypted image [9].Pixel intensities are used rather than bits to reduce computation time.Therefore, pixel intensities are substituted using enhanced version of the CLM, which is explained in Section 2.1.1.
An example of this substitution is shown in Tables 1 and 2.
The substituted pixels are shown in Table 2, with a population growth at 5.5 of CLM.
In comparison to Tables 1 and 2, pixel intensity 1 is substituted into pixel intensity 245.The permuted image of Lena is shown in Figure 5 and is substituted, and its image and histogram are shown in Figure 6.The histogram is not similar to uniform distribution; therefore, binary bits are added in the form of a one-time pad, which is explained in the latter sections.

Binary Form of the Image
The data of pixel intensities are now converted as a sequence of binary bits of 8-tuples.The range of pixel intensities is from 0 to 255.The pixel intensities from Section 2.3 (each pixel intensity is between 0 and 255) are now converted as a sequence of binary bits of 8-tuples.In the latter section, it will be easier for us to add random binary bits in the pixel intensities to increase the randomness and consequently increase the security of our proposed crypto system.

Bit Generation
It is a common misconception that a one-time pad is breakable.The opposite is true.If the key used in a one-time pad is random and is kept hidden from all possible hacks (attacks), then the only possible way to hack a one-time pad is by a brute force algorithm [41].
In this attack, all possible combinations are applied.For example, if the key consists of two bits, then there are 2 2 = 4 possible combinations.This means that, for a two-bit key, the hacker must enter the key four times.One of them is the actual key.In this way, a brute force attack can occur.In general, if the key is n bits long, then there will be 2 n combinations.C. E. Shannon [2] in his paper proves that ideal secrecy depends on the randomness of the key.
It is evident from the graph in Figure 7 that, if we increase the number of bits, then the number of combinations will also increase exponentially.Therefore, the hacker must have to enter more and more combinations if the key gets longer.The pseudorandom orbit of a chaotic logistic map is very high.The secret keyspace that a chaotic logistic map can offer is more than 2 302 [40].The random binary bits are generated from the CLM.

XOR Operation
The binary of the pixel intensities and binary bits from the CLM are added in the form of an "XOR" operation.In the "XOR" operation, the same bits result in the output 0 and bits that are not the same give the output 1.

Conversion of Binary Bits to Encrypted Image
The resultant binary bits are then converted into pixel intensities.The acquired pixel intensities represent the encrypted image of Lena from the proposed algorithm.As an example, the substituted image of Lena shown in Figure 6 is then XORed.The encrypted image and its histogram are shown in Figure 8.The histogram resembles uniform distribution, as shown in Figure 8.

Pseudocode
The flowchart of the encryption process is given in Figure 2. The decryption process flowchart is given in Figure 9.The pseudocode for the encryption and decryption process is as follows:

1.
Input image is substituted using modified CLM.

2.
Substituted image is then permuted using modified CLM.

3.
Substituted pixels are then converted into binary bits.4.
Pseudorandom bits are evaluated from CLM. 5.
Resultant bits are converted into pixels; therefore, an encrypted image is obtained.

1.
Encrypted image is converted into binary bits.

2.
Pseudorandom bits are evaluated from CLM.

4.
Binary bits are converted into pixels.

5.
Reverse operation of substitution is applied.

6.
Reverse operation of permutation is applied; therefore, an input image is obtained.

Results
We perform numerous statistical tests on the proposed encryption algorithm.These statistical tests include keyspace analysis, sensitivity analysis, strict avalanche criteria (SAC), histogram analysis, entropy analysis, mean of absolute deviation (MAD) analysis, correlation analysis, contrast analysis and homogeneity.The images used in the testing are taken from the University of Southern California-Signal and Image Processing Institute (USC-SIPI) database [42].

Computational Analysis
Computational complexity plays a key role in defining the cost and time of the encryption algorithm.Therefore, two main analyses are used.Keyspace analysis is used to check the proposed algorithm's security against a brute force attack.Complexity analysis is used to check how much memory and time is utilized for the encryption process.

Keyspace Analysis
It is a well-known fact that a large keyspace is essential for an encryption algorithm to be resistant against a brute force attack [43].The proposed algorithm uses the key at four different stages.First, the key is broken into four parts.The first two parts are used for permutation of the image.It has (256 × 256)! distinct combinations.The third part is used in the S-box for substitution.It has 256! distinct combinations.The fourth part is used in obtaining the pseudorandom bits from the CLM.It ranges from [3.6, 4].Therefore, it accumulates a huge keyspace, and, as a result, increases the security of the encryption scheme.

Complexity Analysis
Complexity analysis is used to check how much memory and time is used to run a certain algorithm on a machine.
The permutation performance of the proposed algorithm is compared with some of the classical encryption algorithms as shown in Table 3.The proposed algorithm shows the best performance.

Sensitivity Analysis
The initial conditions of any algorithm play a key role in its security.Therefore, the security of the algorithm is dependent on its initial conditions.For this, two common measures are used [44,45], i.e., the number of pixels change rate (NoPCR) and unified average pixel changing intensity (UAPCI).This will make the encryption algorithm resistant against differential attacks.Strict avalanche criteria (SAC) are also used to verify the algorithm's sensitivity.

Number of Pixels Change Rate (NoPCR)
This is used to check how a minute change in the input image can affect the output image.For this purpose, an input image is acquired, and only a one-bit change is performed in it.In image processing, a one-bit change means one intensity change in pixel value.The original input image and the one-bit-changed image are processed through the algorithm, and two separate ciphered images are acquired.After that, the following relationship is applied to both of the images.
where C 1 = cipher image of input image; C 2 = cipher image of input image with one-bit change; D(x, y) = matrix used to calculate difference between C 1 and C 2 ; B = breadth of the image; H = height of the image.
x and y represent the positions of the pixel in the horizontal and vertical direction, respectively.In this manner, a percentage is computed to check how many pixels are changed in both of the ciphered images, i.e., between C 1 and C 2 .In this way, we are checking the security of our proposed algorithm.This is applied on various images, and some of the results are given in Table 4.In Table 4, it is evident that a one-bit change in the input image can result in a more than 99% change in the ciphered image.

Unified Average Pixel Changing Intensity (UAPCI)
In the previous subsection, the change in number of pixels is calculated for the entire image.In this subsection, we compute how much one pixel is changed according to its neighboring pixel.A unified average value is computed for the whole image.First, two ciphered images are taken, whose input image is changed in one bit.
where C 1 = cipher image of input image; C 2 = cipher image of input image with one-bit change; B = breadth of the image; H = height of the image.
x and y represent the positions of the pixel in the horizontal and vertical direction, respectively.In Table 5, the UAPCI of various images with different image sizes along with a one-bit change in the input image is given.It is proved from this table that an average of 7% change occurs from pixel to pixel if there is a one-bit change in the input image.These two measures show that the proposed algorithm is dependent on the input image.If any hacker tries to change the one-bit value in the system, it can easily be identified.These are applied to check the algorithm's dependency on its initial conditions in such a manner that one bit in "O" creates more than a 50% change in "C".A function g : Z n 2 → Z m 2 exhibits the avalanche effect if and only if where O = original image; C = cipher image; ⊕ = exclusive OR operation.Equation ( 6) depicts that if one input bit is changed then 50% of the output bits must change [46,47].Therefore, strict avalanche criteria were applied to the proposed algorithm and it was found that almost 50% bits are inverted.Table 6 gives the comparison of SAC of various algorithms.Table 6.SAC comparison of various algorithms.

Histogram Analysis
This analysis is performed to check whether the encrypted image represents any resemblance toward the original image or not.If the histogram of the image is equiprobable, then it is hard for the attackers to know which original image is transmitted.Equal distribution gives no clue to the hackers and it increases the security of the algorithm.The original images of Lena and Boat along with their histograms are shown in Figures 4 and 10.Furthermore, the histogram is equally distributed as shown in Figures 11 and 12. Therefore, it makes it hard for the hackers to retrieve the original message.

Entropy Analysis
Entropy gives us the measure of randomness and distortion within the gray values of the image [49].In order to achieve an ideal distribution, the entropy should be equal to 8 [50].In this proposed algorithm, the entropy of various images is found and is close to 8. The entropy of various images is given in Table 7.In Table 8, the entropy of the proposed algorithm is compared with AES [51] and one of its variations [51].It is verified that the average entropy of the algorithm is better than AES and much closer to 8.

Mean of Absolute Deviation (MAD) Analysis
If the difference between the input image and the encrypted image is high, then it becomes more difficult for the hackers to decode the data.MAD analysis gives us the quantified value of how much of the encrypted image is displaced from the input image [52,53].MAD is determined to compute the difference between two images.MAD can be mathematically represented as follows: where O xy = pixels of the original image at the (x, y) position; C xy = pixels of the encrypted image at the (x, y) position; B = breadth of the image; H = height of the image.MAD analyses of various images are performed, and the results are compiled in Table 9.

Correlation Analysis
Correlation is the measure of the dependency of one image on another.Every algorithm designer tries to reduce the dependency.It will be harder for a hacker to perform any kind of malicious activity.Therefore, it is essential in increasing the algorithm's security.It is computed by the following equation: Table 10 gives the correlation between various original images and their cipher images.It is evident from Table 10 that the correlation is less than 1%.Also in Table 11, the correlations of AES and its variations are compared with our proposed algorithm.It is verified that the correlation of the proposed algorithm is less than 1%.Therefore, it shows that it is hard for the hackers to determine the original image from the cipher image.

Contrast Analysis
This provides the user with an identification of the textures of two images.This analysis allows the user to identify any resemblance of texture between two separate images [54,55].If the texture of an original image and its encrypted image has any closeness of texture between them, it computes contrast using Equation (9).In this equation, it is clearly visible that a co-occurrence matrix is used to compute contrast value.This basically gives any kind of resemblance between any neighboring pixels of the same image.It is mathematically represented as follows: where p(x, y) = gray-level co-occurrence matrix; B = breadth of p(x, y); H = height of p(x, y).
x, y represents the location of elements within p(x, y).
In Table 12, it is evident that the proposed algorithm encrypts any two or more images and that those encrypted images have the same contrast value.This shows that it is harder for any hacker or intruder to compromise the security of the proposed algorithm.Contrast analysis is performed with various encryption algorithms, which are given in Table 13.It is shown that the proposed algorithm is good at hiding the features and information inside an input image.

Homogeneity
This measures the closeness of elements within a specified image.This analysis shows how the neighboring elements of a pixel are related to each other.This method is based on the distribution of any pixel with respect to its neighboring pixels.It gives the statistical distribution over the whole image.
The homogeneity can be determined using the following relation: where p(x, y) = gray-level co-occurrence matrix.
x, y represents the location of elements within p(x, y).This test is applied on various images of different sizes.Some of the values are given in Table 14 along with different image sizes.The proposed encryption algorithm gives the homogeneity value around 38-40%.It is also hard for the hacker to determine the original image from the encrypted image.

Comparative Analysis with the Other Encryption Algorithms
A substantial amount of experimentation has been performed on the proposed algorithm to compare them with the other encryption methods.Table 15 gives a comparison between the proposed algorithm and other encryption algorithms.In this table, the encryption time is given for the 512 × 512 image and the unit is seconds.
The table proves the following: • NoPCR of the proposed algorithm proves that 99% of the information inside the input image is scattered in the encrypted image • UAPCI proves that there is a 10% average change in the encrypted image as compared to others, which are 33%.This makes the encryption algorithm more robust against differential attacks, consequently enhancing its security.

•
The entropy of an 8-bit image is 8 if and only if all the information present in it is uniformly and evenly distributed.Therefore, entropy close to 8 is preferable.Tables 7, 8 and 15 prove that the entropy of the proposed algorithm is close to 8.

•
Correlation is a measure that tells us how an image is related to another.The correlation value of our proposed algorithm is 0.28%, which is very minute.Therefore, it proves that the encryption algorithm is good at hiding information of the input image.

•
The encryption time is calculated for a 512 × 512 image.The results show that it takes 15 ms to complete the encryption process.Therefore, it is shown here that the algorithm takes less time for the encryption in comparison to others.

Conclusions
In this study, an image encryption algorithm is proposed that is based on CLMs.The algorithm's security is verified through various tests, which include keyspace analysis, complexity analysis, sensitivity analysis, strict avalanche criteria, histogram analysis, entropy analysis, mean of absolute deviation analysis, correlation analysis, contrast analysis and homogeneity.These tests show a high level of security in image encryption applications.Researchers/practitioners can use the proposed encryption algorithm in different fields, such as image encryption, data encryption, audio/video encryption.etc.

Figure 6 .
Figure 6.Substituted image of Lena and its histogram showing no information regarding original image.

Figure 7 .
Figure 7. No. of bits vs. no. of combinations graph depicting exponential growth.

Figure 8 .
Figure 8. Encrypted image and its histogram.

Figure 10 .Figure 11 .Figure 12 .
Figure 10.Original boat image and its histogram depicting various peaks in the pixel intensities.
where corr(O, C) = correlation between the original image and its encrypted image; O = original image; C = cipher image; µ o = mean of the original image; µ c = mean of the encrypted image; E = expected value operator; σ o = standard deviation of the original image; σ c = standard deviation of the cipher image.

Table 1 .
Input pixel intensities for substitution.

Table 2 .
Pixels arranged in random order based on CLM with population growth at 5.5.

Table 3 .
Complexity analysis of different permutation algorithms with the proposed algorithm.

Table 7 .
Entropy of various images.

Table 8 .
Entropy of various algorithms.

Table 9 .
MAD analysis of various images.

Table 10 .
Correlation of various images.

Table 11 .
Correlation of various algorithms.

Table 12 .
The contrast of various images.

Table 13 .
Comparison of contrast with other algorithms.

Table 14 .
Homogeneity of various images.

Table 15 .
Comparative analysis with the other encryption algorithms.