Abstract

Images, as one of the important carriers for information exchange, play an important role in work and daily life. Image encryption technology has received a lot of attention, and varieties of encryption technologies for images have emerged. Early image encryption technologies have shortcomings such as simple algorithm structure, small key space, and poor resistance to plaintext attacks. These algorithms have been unable to meet the needs of information security at this stage. Based on the wavelet algorithm, chaos algorithm, and cyclic encryption algorithm, combined with frequency domain encryption and spatial domain encryption, a digital image encryption algorithm based on adaptive wavelet is proposed in this paper. In terms of frequency, this paper enhances the adaptive ability of the wavelet algorithm by convex optimization-particle swarm optimization (PSO). At the same time, the chaotic algorithm is used to scramble the low-frequency coefficients. In the aspect of airspace, this paper uses the block-encryption adaptive encryption algorithm to rescramble the wavelet-reconstructed image. And the SHA-1 algorithm is introduced into the plaintext image generation key sequence as a cyclic index value for cyclic encryption. The key composition of the encryption algorithm proposed in this paper is complex, and the idea of a one-time pad is used, which makes the improved algorithm increase the key space and improve the ability to resist the choice of plaintext attack. In each cyclic encryption of the airspace, mutual encryption is performed by image subblocks, and the algorithm adaptability is improved. Through the experimental test of statistical characteristics, key space, and key sensitivity, the encryption performance of the algorithm is verified, and it has strong antiattack and interference ability. It is a relatively secure encryption algorithm.

1. Introduction

As one of the important carriers of information exchange [14], images play an important role in work and daily life. During the transmission of digital images, some picture information may involve personal privacy, even involving trade secrets and state secrets. When such information is illegally accessed, stolen, or even tampered with, it will have serious consequences, cause huge economic losses, even endanger national security [5]. How to prevent the occurrence of these security incidents and provide security in digital image transmission is a research topic of concern [6].

At present, there are two main methods for protecting digital image information [5]: digital watermarking technology and image encryption technology [7]. The digital watermarking technology directly embeds segment identification information (digital watermark) into digital images, which does not affect the information value of the original image and is not easily noticed by the human visual system [8]. However, this technology cannot hide the visible information of digital images and reduces the security of digital images transmitted over the network. The image encryption technology uses the encryption algorithm to completely transform the plain image information into randomly arranged pixels [9], forming a disorganized image and then transmitting it. The attacker or the stealer cannot recognize the encrypted image without knowing the key, so that the image transmitted in the network is effectively protected. In 1949, the idea of “mixing some information” mentioned by Shannon in his published paper “Communication Theory of Secrecy Systems” [10] became the origin of digital image encryption technology. An image encryption algorithm based on a chaotic system is the most widely studied encryption algorithm. Chebyshev chaotic map [11], Rossler system [12], logistic chaotic map [13], three-dimensional Lorenz chaotic system [14], and tent map are common. In 2005, Luo and others [15] proposed an image encryption algorithm with certain adaptive capabilities [16]. The algorithm controls the arrangement of image pixels by using the original image data itself and performs cyclic encryption. Although it can effectively resist the known plaintext attack, the algorithm structure is simple and the security is low. In [17], an adaptive two-dimensional wavelet transform algorithm is proposed. It updates the operator with the local feature information of the image. At the same time, the regression algorithm is used to predict the corresponding operator information, so that the algorithm reduces the energy of the high-frequency coefficient to some extent. However, the feature information acquisition capability of the algorithm is weak. In [18], Chen et al. proposed a new adaptive wavelet-based image encryption algorithm, which mainly uses the particle swarm optimization algorithm to optimize the encryption process, thus improving the wavelet image encryption efficiency. Aiming at the problems of weak adaptive ability and low encryption efficiency of existing image encryption algorithms, this paper introduces optimization algorithms and heuristic algorithms to improve the traditional wavelets, so that wavelets have better adaptive ability. Therefore, this paper uses the optimized wavelet to adaptively decompose the image to obtain multiple image components, then fully utilize the characteristics of initial value sensitivity and parameter sensitivity of chaos theory and select the combination of multiple chaotic systems to encrypt the low-frequency coefficient matrix as the first module of the encryption system. At the same time, this paper also combines the cyclic adaptive encryption algorithm, proposes a cyclic encryption algorithm combining SHA-1 key sequence and adaptive encryption, and adds the process of block encryption, as the second module of the encryption system. In these two encryption modules, the optimized adaptive wavelet and the newly proposed cyclic adaptive encryption technology are used, respectively, which effectively improve the adaptive ability of the encryption algorithm and solve the problems that the traditional image encryption algorithm has low adaptive ability for the plaintext image and poor resistance to selective plaintext attack and other issues.

Section 2 of this paper will mainly explain the digital image encryption algorithm based on the adaptive wavelet chaos proposed in this paper. Section 3 analyzes the image encryption algorithm proposed and compares it with the mainstream encryption algorithm. Finally, the last section summarizes and discusses the full text.

2. Digital Image Encryption Algorithm HA Based on Adaptive Wavelet Chaos

Image encryption technology is divided into two categories according to domain: image spatial domain encryption and image frequency domain encryption. Image spatial domain encryption can achieve high-speed and efficient encryption algorithms, so it is widely used in various fields. However, with the increasing demand for encryption, the image frequency domain encryption algorithm has gradually developed due to the weak ability of the image spatial domain encryption algorithm to resist external attacks. The image frequency domain encryption algorithm transforms the image from the spatial domain to the frequency domain representation by using mathematical transformation. The ciphertext image is obtained by encrypting the coefficients in the frequency domain, and the decryption needs to obtain the plaintext image through inverse transformation. The image frequency domain encryption algorithm uses mathematical transformation to transform the image from the spatial domain to the frequency domain for representation and encrypts the coefficients in the frequency domain to obtain the ciphertext image. The decryption needs to obtain the plaintext image through inverse transformation. There are many methods for transforming an image from a spatial domain to a frequency domain. Discrete Fourier transform, discrete cosine transform, wavelet transform, and the like are widely used.

The frequency domain encryption algorithm has strong initial value sensitivity and has strong robustness against external attacks. In the wavelet transform of the frequency domain, the computational complexity of the lifted wavelet transform is low, which can effectively save the computational cost and relatively reduce the loss of image information in the decryption operation. This paper makes use of the advantages of wavelet lifting and combines the proposed optimization algorithm [19] to design a new encryption algorithm.

2.1. Encryption Scheme Design

The digital image encryption algorithm based on the adaptive wavelet proposed in this paper is mainly divided into two modules:

The encryption algorithm module 1 is shown in Figure 1. Firstly, the optimization algorithm and heuristic algorithm are used to optimize the 9/7 wavelet transform, which can further improve the adaptive ability of wavelet transform. Then, the paper uses the optimized wavelet to decompose the image to obtain a series of image components. Further, the low-frequency coefficient and the high-frequency coefficient of the image to be encrypted are obtained. A set of double chaotic sequences is obtained by using two Logistic chaotic maps with different parameters, and the low-frequency coefficients obtained by image decomposition are scrambled and made confusing. Then, the scrambled low-frequency coefficient and the high-frequency coefficient are reconstructed by the optimized wavelet algorithm. This will give you the scrambled image after the first encryption. At this point, the encryption of module 1 is completed, and the parameters and the initial values of the logistic chaotic map , , , and are used as the keys of the encryption module 1. In order to improve the security of the algorithm, the scrambled image is encrypted a second time.

The encryption algorithm module 2 is shown in Figure 2. After the scrambled image encrypted by module 1 is obtained, the scrambled image is filled and divided, and the scrambled image is equally divided into 4 subimages. And the SHA-1 key is generated by the SHA-1 algorithm according to the plaintext image, and finally, two different modes of adaptive cyclic encryption are performed according to the value of the SHA-1 key.

2.2. 9/7 Wavelet Transform Based on Lifting Algorithm

The finite-length filter is represented by equations (1) and (2) to represent the low-pass filter functions at the decomposition end and the reconstruction end:

The biorthogonal wavelet construction theorem is as follows.

Suppose , , and and are polynomials for , if the following conditions are met: (1)Normalization: and (2) and (3) is established everywhere

So far, a pair of biorthogonal wavelet filters can be constructed according to the and above.

In the 9/7 optimized wavelet algorithm, 9 and 7 represent low pass filter coefficients and high pass filter coefficients, respectively. The two filter coefficients and are divided into odd and even terms, and they are -transformed to obtain the following formula:

Bringing equation (3) into the multinomial matrix at the 9/7 wavelet decomposition end, the following formula can be obtained:

Using the notation in [20, 21], the multinomial matrix is expressed as

Among them,

From the above formulas (4) and (5), we can get

2.3. Adaptive Optimization of Lifting Wavelet Transform

The traditional wavelet structure has many limitations such as low precision and weak adaptive ability in practical applications. At the same time, in the traditional wavelet framework, its updated algorithm method and prediction algorithm are fixed. In this paper, the optimization algorithm and the heuristic algorithm are used to optimize the two algorithms and adjust them continuously to obtain the optimal operation steps and processes, so as to obtain the encryption algorithm with the least error [22, 23].

Decompose the original signal using the optimized wavelet method proposed in Section 2.2 of this paper. The original signal is subjected to lifting wavelet decomposition, and , , , , and are used to represent the coefficients generated by the functions and in the lifting algorithm, and the 9/7 wavelet transform process based on the lifting algorithm is as follows: (1)Parity decomposition: (2)Two liftings: (3)Numerical change:

The adaptive matching lifting wavelet for the original image is equivalent to adaptively select the values of the parameters , , , , and . In order to facilitate the optimization calculation, let the vector , denotes the original image, and denotes the lifting wavelet transform. After the values of , , , , and are determined by the optimization algorithm, the adaptive decomposition of the 9/7 wavelet can be determined.

According to the selection criterion of [24], optimize the lifting wavelet transform, so that the sparsity of wavelet coefficients after wavelet transform is improved. The best parameters are obtained by optimizing

The vector in equation (11) is a parameter vector, and the coefficient after the coefficient is subjected to the sparse approximation and is represented by an unknown vector . Among them, formula (11) contains two unknown models, and the above formula is decomposed into formulas (12) and (13) by the alternating direction method proposed in [24]:

2.3.1. Convex Quadratic Optimization

Formula (12) is optimized in this section to improve the sparsity of the optimized wavelet decomposition. In view of formula (12), the problem of convex quadratic optimization is reflected. Therefore, this paper uses the soft threshold method proposed in [25] to optimize the formula (12).

Let be the soft threshold operator; is defined as follows:

We can get

2.3.2. Particle Swarm Optimization

Optimizing equation (13) above is equivalent to optimizing the following formula [2629]:

The above equation is regarded as a quadratic optimization problem related to the vector . The particle swarm optimization algorithm (PSO) is used to solve the problem, and the optimal solution is searched by iteratively updating the position and velocity parameters of the vector .

The specific algorithm steps are as follows [3032]: (1)Randomly initialize variable parameters: position and velocity (2)The position and speed are updated by In equation (17), represents the inertia coefficient, and represent the learning factor, is the front position, is the global optimal position, and are random values in , and the value of is (3)In general, to improve the efficiency of the algorithm to achieve iterative termination conditions, define as where and represent the maximum inertia coefficient and the minimum inertia coefficient, respectively(4)Take to complete the optimization of formula (13)

For any image, the main steps of decomposing the image using the optimized wavelet method proposed in this paper are as follows: Step 1.Input the original image and initialize vector .Step 2.For , perform lifting wavelet decomposition and let Perform the PSO algorithm to adapt the vector to formula (16).Step 3.Output the optimized .

2.4. Chaotic Map Scrambling Low-Frequency Coefficients

In this paper, the logistic chaotic system in chaos theory is applied. The logistic chaotic system belongs to one-dimensional chaotic systems and is widely used in image encryption because of its complex dynamic behavior [25]. The following formulas (20) and (21) are two one-dimensional logistic mapping formulas with different parameters:

In the formulas, and are parameters, when . The basic steps of using the chaotic theory to add interference factors to low-frequency coefficients are as follows: (1)The low-frequency coefficient to be scrambled is taken as a numerical matrix of , where each element . The pixel values in the matrix are converted into 8-bit binary numbers, and the position of each pixel is represented by , where and . The and of the chaotic map are set, and a set of chaotic sequences is generated by the logistic chaotic map (20), where , and and are used as the keys of the system. The chaotic sequence is discretized according to After discretizing the chaotic sequence , a set consisting of 0 and 1 is obtained. When the sum of is an even number, the 8-bit binary numbers of and in the discretized set are XORed. When the sum of is an odd number, the are exchanged with the last four bits, and then the in the discretization sequence is XORed. After the calculation is completed, a new matrix is generated and each element is represented by (2)A set of chaotic sequences is generated by formula (21), where . The and are used as scrambled keys for the chaotic system. The discretization of by formula (22) results in a discretized set , and the value of is 0 or 1. Set three arrays of , , and with the initial values are null, reorder in (1), and convert to a one-dimensional array using the function in MATLAB. If , the value of is written to the array ; if , the value of is written to the array . and merge to get the array . Using the function in MATLAB, the array is converted into a two-dimensional matrix of rows and columns, as shown in

2.5. Adaptive Cyclic Encryption

A grayscale image of size can be expressed as shown in Figure 3.

A two-dimensional traversal matrix is a bijective function with all elements coming from the set . Traversing the matrix is actually accessing all the elements in a two-dimensional matrix in a certain order. Several commonly used traversal models are as follows, as shown in Figure 4.

2.5.1. Main Traversal Matrix

A matrix of is defined as a traversal matrix. If each element in the matrix belongs to set , and , then there are and , denoted as .

The following matrix is defined as a main traversal matrix, as shown in Figure 5.

In fact, in the algorithm of this paper, the main traversal matrix represents an arrangement order, representing an arrangement of elements in order of magnitude.

2.5.2. Image Scrambling

is the original matrix. To scramble , first assign the element in to the corresponding tag value of each element in ; that is, the element in is the tag value of . All the elements in are reordered according to the tag values in the order of the elements of the main traversal matrix defined in Figure 5, and the scrambled matrix is , such as the scrambling of the matrix of Figure 6.

The traversal model matrix can be randomly selected, or a matrix composed of specific sorting rules can be used, such as the Arnold sorting and Hilbert sorting.

2.5.3. Standardization of the Traversal Model Matrix

In the above scrambling process, when we do not specify a traversal model , an external random matrix can be used as a traversal model in the above process. In the algorithm of this paper, the traversal model is the subblock after the block in the encryption algorithm module 2, and the specific steps for standardizing it are as follows [32]:

The first step: traverse all the elements in . Compare to find the minimum values in the matrix and mark them as 1. If multiple equal minimum elements appear, they are marked in the order of the upper left minimum priority, for example, the standardization process of Figure 7.

The second step: follow the principle of the first step, from 1 to in order from small to large, until all elements are converted to a positive integer from 1 to , as a standardized traversal model matrix.

The scrambling algorithm implemented by traversing the matrix, which can scramble the location of the original data and encrypt the original image. The above scrambling algorithm is improved in the encryption algorithm module 2. The image is segmented first, and the subimage of the image itself is used as the traversal model matrix in the encryption process to implement adaptive encryption, and the SHA-1 key sequence is introduced to cycle the adaptive encryption algorithm; therefore, the security and adaptability of the algorithm is improved. The complete encryption steps of the encryption algorithm module 2 in this paper are as follows: Step 1.Generate a binary SHA-1 key sequence. The key used in the algorithm which is a 160-bit value returned from the plaintext image is calculated by the SHA-1 algorithm described in section 2.1, that is, a set of hexadecimal numbers totaling 40 bits. Each hexadecimal number is represented by a 4-bit binary number, and finally, a set of binary key sequences of 160 bits in length is formed. A binary key sequence is obtained from the original image, such as 1011001. In the encryption process, “0” and “1” represent different encryption models.Step 2.Image segmentation. The scrambled image processed by the encryption algorithm module 1 is subjected to a block operation. First, fill the image and insert rows or columns into the image, so that the number of rows and columns are even. The elements filling the row or column are between 0 and 255 and use them as keys. Also, the filled portion needs to be removed when decrypting; the adjusted image is divided into four blocks: represents the upper left portion, the lower left portion, the upper right portion, and the lower right portion.Step 3.Adaptive encryption. Here, the encryption is performed in accordance with the value and length of the SHA-1 key sequence. When the value in the SHA-1 key sequence, the block image is adaptively scrambled in a clockwise direction, as shown in Figure 8.When the value in the SHA-1 key sequence, the block image is adaptively scrambled in a counterclockwise direction, as shown in Figure 9.The four subblock matrices are sequentially encrypted, taking the clockwise adaptive encryption as an example. According to the above rules, is used as the index to encrypt to obtain , is used as the index to encrypt to obtain , is used as the index to encrypt to obtain , and is used as the index to encrypt to obtain . After the last cyclic encryption is completed according to the SHA-1 key sequence, the ciphertext image is outputted.Step 4.Cyclic encryption. After performing Step 3 above, do the following:

In the cyclic encryption process, when proceeding to Step 3 again, the that has been encrypted in the previous round is used as a blocked image matrix for cyclic encryption. The initial value of is 0, indicating the number of times the cyclic encryption has been performed. can be the set number of the cycle, or it can be the default length of the SHA-1 binary sequence.

3. Simulation Experiment Results and Key Security Analysis

In this paper, MATLAB R2018a is used as the simulation experiment platform. The Lena.jpg image and the peppers.jpg image are selected as examples to carry out experiments and analysis. The plain text image is shown in Figure 10.

Encrypting Lena.png and peppers.png using the image encryption algorithm proposed in this paper, the obtained encrypted and decrypted images are shown Figures 11 and 12. The encrypted images (Figures 11(b) and 12(b)) do not show any information related to the plaintext images. It can be seen that the encryption algorithm effectively hides the plaintext information.

3.1. Key Space Analysis

The key of the encryption algorithm proposed in this paper consists of four parts. The formula (25) represents the key composition of the algorithm:

The key is the number of the wavelet decomposition, the threshold is related to the SHA-1 sequence, the parameters and are of the chaotic system, the initial values and form the key , and the 160-bit key sequence is generated from the plaintext image; the matrix fills the image matrix before cyclic encryption. For the integer key, the key space corresponding to the key of length is and the key space of each decimal key is ; therefore, the key space of the algorithm is about , which is much larger than the key space requirement of , so the key space of the algorithm of this paper can resist exhaustive attacks.

3.2. Key Sensitivity Analysis

Figure 13 shows the experimental results of encrypting and decrypting the Lena.png only when a slight change (only ) is made to the two key parameters in the key. As can be seen in Figure 13, when the error key is used for decryption, the obtained image (b) is a chaotic image in which no information can be obtained. It can be proved that the sensitivity of the encryption algorithm to the key parameter can reach . Combined with the results of the key space analysis in the previous section, it can fully demonstrate that the encryption algorithm of this paper has strong key sensitivity and can effectively resist statistical analysis attacks.

3.3. Information Entropy Analysis

Information entropy defines an important feature of randomness and uncertainty in digital image data. It is widely used to measure the uniform distribution of the pixel gray scale in images. If the gray value is distributed evenly, the amount of information of the image is larger. The information entropy calculation formula is as follows: where represents the probability that the symbol set appears in the message. To better verify the advantages of the encryption algorithm proposed in this paper, Table 1 shows the information entropy of the three different images using the algorithm and other mainstream encryption algorithms.

It can be seen from Table 1 that the ciphertext image information entropy of the encryption algorithm proposed in this paper is the highest, reaching 7.998 or more. It is also the encryption algorithm closest to the best information entropy value of 8. It also verifies that the image distribution encrypted by the encryption algorithm of this paper is very random, and the amount of information needed to crack it is also the largest, and it is the easiest to find the law. Therefore, from the perspective of information entropy attack, the encryption algorithm proposed in this paper is the most secure compared to other encryption algorithms.

3.4. Peak Signal-to-Noise Ratio Analysis

To verify the encryption effect of the proposed algorithm, Table 2 shows the peak signal-to-noise ratio (PSNR) of the decrypted image after the Lena, couple, and gray grayscale images are encrypted using the algorithm and other mainstream encryption algorithms.

It can be seen from Table 2 that although the PSNR of the image obtained by the encryption algorithm is not much higher than that obtained by other algorithms, the PSNR of the image after decryption is still the highest. It further shows that the encryption algorithm proposed in this paper retains the richest original information and loses the least information.

3.5. NIST Random Test

This paper uses the STS2.1 version of NIST to perform randomness testing on the pseudorandomness of the proposed encryption algorithm. In this paper, 2000 pseudorandom sequences are randomly generated for testing, and each sequence has a length of bits. The results are shown in Table 3.

It can be seen from Table 3 that the encryption algorithm proposed in this paper has passed various indicator tests.

3.6. Speed Analysis and Antiaggressive Analysis

The image encryption algorithm should not only consider the security performance but also consider whether its running speed meets the actual needs. Therefore, this section uses the encryption algorithm proposed in this paper to perform encryption and decryption tests on different sizes of images and to calculate the calculation time. The experimental environment is a CPU Core Duo 2.84 GHz, memory 8 GB, Windows 7 system and the test software is MATLAB 2018a. The details are shown in Table 4. At the same time, this experiment gives the encryption and decryption calculation times of this paper’s encryption algorithm and other mainstream encryption algorithms for a same-sized image, as shown in Table 5.

It can be seen from Tables 4 and 5 that the encryption algorithm proposed in this paper is not only acceptable for encryption efficiency. Moreover, the encryption algorithm proposed in this paper is more effective than the encryption of other mainstream encryption algorithms.

Since the encryption algorithm proposed in this paper initializes the scrambled data in a one-time-one-manner, that is, the same plaintext is used to encrypt the same plaintext, the result of each encryption will not be the same. Therefore, this paper can resist the plaintext attack to a certain extent.

4. Conclusion

With the advancement and development of computer application technology, the proportion of images in the data transmitted through the Internet is increasing, and the security of image transmission has become the focus of attention. The encryption technology that was widely recognized as high security has gradually become less secure with the development of cryptanalysis technology. This paper studies and improves the security problems in image encryption technology. The main conclusions of this paper are as follows: (1)This paper proposes an image encryption method based on adaptive optimization wavelet transform. It integrates an adaptive optimization wavelet into image encryption, which can effectively improve the adaptive ability and encryption efficiency of a traditional wavelet image encryption algorithm. In this process, the particle swarm optimization algorithm is used to optimize the parameters involved in the traditional 9/7 wavelet transform, which can effectively improve the sparsity of the coefficients after wavelet decomposition(2)A block-based adaptive encryption method based on spatial domain is proposed. In the cyclic encryption process, each cyclic encryption will block the input image, and the subblocks use their own data to encrypt each other, which improves the adaptability of the entire encryption algorithm(3)Combining the image encryption system based on adaptive wavelet transform with the spatial domain-based block adaptive encryption algorithm, an improved digital image encryption algorithm based on the adaptive wavelet is proposed. The plaintext image is encrypted in the frequency domain and the airspace. The experimental results show that the image encryption algorithm proposed in this paper can effectively improve the encryption effect and encryption efficiency

The authors completed the experimental design work on the basis of theory and used MATLAB R2018a as the simulation experiment platform to realize the encryption and decryption process of the image encryption algorithm. Through the analysis of the experimental results and the strong support of the experimental data, it is proven that the improved algorithm improves the self-adaptation, improves the security of the encryption algorithm, and makes up for the shortcomings of the traditional encryption algorithm. The algorithm has obvious advantages in resisting the chosen-plaintext attacks and hiding the probability distribution of the pixels in the plaintext image. The example analysis shows that the proposed algorithm has certain advantages over the mainstream algorithms in terms of information entropy, peak signal-to-noise ratio, calculation speed, and antiaggression. It objectively verifies the validity, rationality, and reliability of the proposed algorithm.

Data Availability

The data and code used to support the findings of this study are included within the paper.

Conflicts of Interest

The authors declare no conflict of interest.

Acknowledgments

This study was funded by the National Natural Science Foundation of China (No. 61701188), China Postdoctoral Science Foundation (No. 2019M650512), and Beijing Intelligent Logistics System Collaborative Innovation Center (No. BILSCIC-2019KF-22).