Next Article in Journal
Optimization of the 24-Bit Fixed-Point Format for the Laplacian Source
Next Article in Special Issue
A Switchable Chaotic Oscillator with Multiscale Amplitude/Frequency Control
Previous Article in Journal
Hotelling T2 Control Chart for Detecting Changes in Mortality Models Based on Machine-Learning Decision Tree
Previous Article in Special Issue
Dynamic Behavior Analysis and Synchronization of Memristor-Coupled Heterogeneous Discrete Neural Networks
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

A Color Image Encryption Algorithm Based on Hash Table, Hilbert Curve and Hyper-Chaotic Synchronization

1
School of Electronics and Information, Hangzhou Dianzi University, Hangzhou 310018, China
2
School of Computer Science and Electronic Engineering, Hunan University, Changsha 410082, China
3
School of Electrical, Electronic and Computer Engineering, The University of Western Australia, Perth 6009, Australia
*
Author to whom correspondence should be addressed.
Mathematics 2023, 11(3), 567; https://doi.org/10.3390/math11030567
Submission received: 7 December 2022 / Revised: 13 January 2023 / Accepted: 18 January 2023 / Published: 21 January 2023
(This article belongs to the Special Issue Chaotic Systems and Their Applications)

Abstract

:
Chaotic systems, especially hyper-chaotic systems are suitable for digital image encryption because of their complex properties such as pseudo randomness and extreme sensitivity. This paper proposes a new color image encryption algorithm based on a hyper-chaotic system constructed by a tri-valued memristor. The encryption process is based on the structure of permutation-diffusion, and the transmission of key information is realized through hyper-chaotic synchronization technology. In this design, the hash value of the plaintext image is used to generate the initial key the permutation sequence with the Hash table structure based on the hyper-chaotic sequence is used to implement pixel-level and bit-level permutation operations. Hilbert curves combining with the ciphertext feedback mechanism are applied to complete the diffusion operation. A series of experimental analyses have been applied to measure the novel algorithm, and the results show that the scheme has excellent encryption performance and can resist a variety of attacks. This method can be applied in secure image communication fields.

1. Introduction

In recent years, the efficiency of information exchange has been greatly improved with the development of mobile Internet and 5G technology, and at the same time, information security is facing great challenges. Digital images are widely used on the Internet because they are easy to store and can express information vividly. Therefore, the encryption processing and secure communication of images have attracted the attention and research of scholars [1,2,3]. Traditional text encryption algorithms such as Data Encryption Standard (DES) and Advanced Encryption Standard (AES) have sufficient security [4,5]. However, due to the large amount of data in digital images, high pixel redundancy, and high correlation between adjacent pixels, the above algorithms perform poorly in image encryption efficiency.
Chaotic systems are extremely sensitive to initial values and parameters, and generate chaotic sequences with aperiodic and pseudo-random characteristics, and it is widely used in image encryption algorithm and pseudo-random number generator design. Li et al. used the sequence obtained from the one-dimensional Tent chaotic map to design the image encryption algorithm, but the complexity of the low-dimensional chaotic system was insufficient, resulting in low security of the encryption algorithm [6]. With the development of chaos theory, the application of high-dimensional hyper-chaotic systems in image encryption has gradually gained attention. Sun et al. used a five-dimensional hyper-chaotic system to generate a set of key streams, and combined the pixel-level and bit-level two levels in the permutation operation [7]. This kind of permutation algorithm not only changes the pixel position, but also changes the statistical characteristics of the histogram. Zhu et al. proposed a new five-dimensional hyper-chaotic system based on Logistic map and Lorenz map to design image encryption algorithms. The algorithm divides the plaintext image into equal blocks for diffusion operation, and each block affects each other, which enhances the connection between the algorithm and the plaintext [8]. Li et al. connected different chaotic maps in parallel to generate pseudo-random sequences for image encryption more efficiently [9]. El-Khamy et al. used Chen’s hyper-chaotic system for image diffusion operations, and used logistic map combined with DNA coding rules for permutation operations. The comparison with similar algorithms shows that this algorithm has a better encryption effect [10]. Wen et al. proposed an image cryptosystem adopting a quantum chaotic map and the certain security-enhanced mechanisms, and verified their performance [11].
Chaotic encryption algorithm has made many breakthroughs in theory, and researchers found that the level of the randomness of chaotic sequences directly affect the encryption effect of the algorithm. As novel circuit elements, memristive elements perform excellent nonlinear characteristics, and have been introduced to the chaotic circuits design. In [12], a nonlinear oscillating circuit with coexisting attractors is researched based on the nonvolatile memcapacitor and meminductor models. In [13], a novel memristor based hyperchaotic system with controlled hidden attractors is studied and discussed. In [14,15], methods for designing N scroll and multi-structure chaotic attractors based on memristive Hopfield neural network are proposed. Especially, in [16,17], the memristor based hyperchaotic circuits and neural network are applied to medical image encryptions. Because the tri-valued or multi-valued memristors have higher nonlinearity, systems based on them are easily to generate sequences with higher randomness, which is beneficial to improve the security of chaotic encryption algorithms. In 2020, Wang’s team realized the first tri-valued memristor based chaotic system [18]. In 2022, a tri-valued memristor based hyperchaotic system with hidden and coexistent attractors is further studied, and the analysis results verify that the introduction of tri-valued memristor can greatly enhance the complexity of existing chaotic system [19]. Based on these fruits, this paper presents a novel encryption algorithm by combining hash table and Hilbert curve with hyper-chaotic synchronization technique. Simulation results and characteristics comparison experiments verified the proposed algorithm has both high security and efficiency.
This paper is organized as follows. Section 2 introduces the preliminary work of designing encryption algorithm, including the discretization of hyper-chaotic system, chaotic synchronization, Hash table and Hilbert curve. Section 3 gives a specific introduction to the image encryption algorithm. Section 4 carried out a series of simulation experiments and security analysis on the encryption algorithm. Finally, Section 5 gives the conclusions about this paper.

2. Preliminaries

2.1. Tri-Valued Memristor-Based Hyper-Chaotic System and Its Discretization

2.1.1. Memristor-Based Hyper-Chaotic System

A tri-valued memristor based hyper-chaotic system is proposed in [19], which has been verified with good potential applications in the field of cryptography. The expression of such a memristor-based hyper-chaotic system is following:
{ x ˙ = a ( y x ) y ˙ = c y x z z ˙ = x y b z d G ( w ) w ˙ = z ,
where x, y, z and w are system state variables, and a, b, c and d are system parameters. G(w) is the memductance of the tri-valued memristor shown in (2), and w is the dimensionless mathematical representation of the flux φ.
G ( φ ) = a 0 + b 0 sgn ( φ + c 0 ) d 0 sgn ( φ c 0 ) ,
where a0, b0, c0 and d0 are are the parameters of the tri-memristor, and sgn(·) represents the sign function. Setting the parameters a = 12, b = −1, c = −1.2, d = 50, a0 = 2.5, b0 = 4, c0 = 1 and d0 = 2.5, and the system initial values [x0, y0, z0, w0] = [0.1, 0.1, 0.1, 0.1], the Lyapunov exponents are calculated and verified as LE1 = 2.4566, LE2 = 0.3086, LE3 = −0.0064 ≈ 0 and LE4 = −14.9588.

2.1.2. Discretization of the System

To implement the above system on the digital software platform, the system need to be discretized. There are two main algorithms for discretization of chaotic systems, the Euler algorithm and Runge-Kutta algorithm. The Euler algorithm uses less resources and operates faster, which is easy to implement on a digital software platform. Therefore, we use Euler algorithm to discretize the system. The Euler algorithm is implemented according to the definition of the derivative. When Δt→0 or takes a smaller value, the definition of the derivative can be approximately described as:
d x ( t ) d t = lim Δ t 0 x ( t n + Δ t ) x ( t n ) Δ t lim Δ t 0 x n + 1 x n Δ t x ( n + 1 ) x ( n ) Δ t .
Introducing (3) into (1), we can get
{ x ( n + 1 ) x ( n ) Δ t = a ( y ( n ) x ( n ) ) y ( n + 1 ) y ( n ) Δ t = c y ( n ) x ( n ) z ( n ) z ( n + 1 ) z ( n ) Δ t = x ( n ) y ( n ) b z ( n ) d G ( w ) w ( n + 1 ) w ( n ) Δ t = z ( n ) .
Rewriting (4) as a difference equation, the discretized system expression is shown in (5).
{ x ( n + 1 ) = x ( n ) + [ a ( y ( n ) x ( n ) ) ] Δ t y ( n + 1 ) = y ( n ) + [ c y ( n ) x ( n ) z ( n ) ] Δ t z ( n + 1 ) = z ( n ) + [ x ( n ) y ( n ) b z ( n ) d G ( w ) ] Δ t w ( n + 1 ) = w ( n ) + z ( n ) Δ t ,
where ∆t = 0.001, indicating the sampling interval. Setting the parameters a = 12, b = −1, c = −1.2, d = 50, a0 = 2.5, b0 = 4, c0 = 1 and d0 = 2.5, and the initial values [x0, y0, z0, w0] = [0.1, 0.1, 0.1, 0.1], the phase diagram of the discretized system is obtained as shown in Figure 1. It can be seen that the discretized system retains the dynamic characteristics of the continuous system relatively completely. Therefore, the Euler algorithm can accurately realize the discretization of the hyper-chaotic system.

2.2. Hyper-Chaotic Synchronization

In the field of information encryption, the required key stream can be obtained at the decryption end through the chaotic synchronization technology, which reduces the transmission risk of the key in the channel.
Chaotic synchronization includes complete synchronization and generalized synchronization. The complete synchronization means that the driving system and the response system are consistent in the variable trajectory, and the error is 0, while the generalized synchronization means that the relationship between the variables is a function, as shown in (6).
lim t | x 1 ( t ) h ( x 2 ( t ) ) | = 0 ,
where x1(t) is the driving system variable, x2(t) is the response system variable, and h(x) represents the potential functional relationship. When h(x) = x, it is complete synchronization, so generalized synchronization includes complete synchronization.
According to the above theory, this section uses the variable feedback method to synchronize the hyper-chaotic system to realize the key transmission between the encryption end and the decryption end [20]. The specific implementation method is following:
The expression of the drive system is given by
{ x 1 ( n + 1 ) = x 1 ( n ) + [ a ( y 1 ( n ) x 1 ( n ) ) ] Δ t y 1 ( n + 1 ) = y 1 ( n ) + [ c y 1 ( n ) x 1 ( n ) z 1 ( n ) ] Δ t z 1 ( n + 1 ) = z 1 ( n ) + [ x 1 ( n ) y 1 ( n ) b z 1 ( n ) d G 1 ( w 1 ) ] Δ t w 1 ( n + 1 ) = w 1 ( n ) + z 1 ( n ) Δ t .
Secondly, the feedback term is introduced, and the controlled response system is obtained as shown in (8).
{ x 2 ( n + 1 ) = x 2 ( n ) + [ a ( y 2 ( n ) x 2 ( n ) ) + k 1 ( x 2 ( n ) x 1 ( n ) ) ] Δ t y 2 ( n + 1 ) = y 2 ( n ) + [ c y 2 ( n ) x 2 ( n ) z 2 ( n ) + k 2 ( y 2 ( n ) y 1 ( n ) ) ] Δ t z 2 ( n + 1 ) = z 2 ( n ) + [ x 2 ( n ) y 2 ( n ) b z 2 ( n ) d G ( w 1 ) + k 3 ( z 2 ( n ) z 1 ( n ) ) ] Δ t w 2 ( n + 1 ) = w 2 ( n ) + [ z 2 ( n ) + k 4 ( w 2 ( n ) w 1 ( n ) ) ] Δ t ,
where k1, k2, k3 and k4 are variable feedback gains.
Setting the system errors as ex(n) = x1(n) − x2(n), ey(n) = y1(n) − y2(n), ez(n) = z1(n) − z2(n) and ew(n) = w1(n) − w2(n), while setting the initial value of the drive system and response system to be [0.1, 0.1, 0.1, 0.1] and [1.2, 3.2, 7.2, 4.5] respectively. If k1 = 0, k2 = −30, k3 = 0, and k4 = 0, then the system error obtained by numerical simulation is shown in Figure 2.
It can be seen that the variable errors ex, ey and ez all reach 0 in the simulation process, while ew becomes a non-zero constant, indicating that generalized synchronization has occurred, which can be applied to the study of image encryption.

2.3. Hash Table Structure

Hash table represents a data structure mainly used to access data efficiently [21]. Its structure contains three components, namely the keyword K, hash function f and storage slot m, as shown in Figure 3, where a1, a2, …, an are the values of K, and 1, 2, …, n are the storage indexes of m. The specific operation process is that for any given keyword K, the function f(K) can be obtained and then the index value of K in m will be get, and finally K will be stored in the corresponding index position.
If the hash function is ideal, it can output different indices n corresponding to different keywords K. However, in practice, there may be multiple K corresponding to one index, which will result in data confusion. This phenomenon is called as the hash conflict, needing to be considered and solved.
Common conflict resolution methods include open hashing and closed hashing. Open hashing means storing the conflicting K values outside m, and closed hashing means storing the conflicting K values in other free locations in m. This section use closed hashing to resolve hash conflicts according to the characteristics of hyper-chaotic sequences. Specifically, the repeated items in the sequence are processed, and free positions are obtained to store new index values, and then an index sequence without repeated values is constructed for the image encryption algorithm.
As shown in Figure 4, xS is an integer sequence of length 15, and the goal is to put all these integers in 15 positions without duplicates. Firstly, finding the repeated values in xS and setting it as −1 to indicate free positions, as shown in Figure 4b. Secondly, creating a sequence NS of the same size as xS. If the index value i of NS appears in the xS, then fill in the number 1 in the corresponding position of NS, otherwise fill in 0, as shown in Figure 4c. Finally, find the missing index value in xS and fill in the sequence p, and then use Algorithm 1 to fill p into xS, an index sequence xH without repeated values is obtained, as shown in Figure 4d, and the pseudo-code of Algorithm 1 is shown in Algorithm 1.
Algorithm 1: Fill missing index values into sequence x S  
Input:   x S   , p
Output: xH
Set xH =   x S   ;
Set Lx = length( x S   ) and Lp = length(p);
Set i = 1, j = 0, and s = 0;
for i = 1 to Lx do
 if   x S   [i] = −1 then
    s = mod(xH[i − 1], Lpj) + 1;
    xH[i] = p[s];
    p[s] = p[Lpj];
    j = j + 1;
 end if
end for
It is worth pointing out that in Figure 4d, if the traditional sequential filling method is used, the index values 8, 9 and 10 will be adjacent, thus reducing the randomness of the sequence xH [21]. However, in Algorithm 1, the filling order of p to xH is determined by xS and p, and there is no fixed rule, which improves the randomness of the index sequence xH and is more suitable for image encryption algorithms.

2.4. Hilbert Curve

Hilbert curve is a kind of curve that traverses all points in a square grid without interruption, it can be obtained by dividing and connecting the squares, as shown in Figure 5. By analogy, the nth division will obtain 4n small squares, which can be connected to form an nth-order Hilbert curve.
The position and direction of the starting point of a Hilbert curve determines the traversal order of the curve in space. Therefore, combining the position and direction of the starting point, we will get eight kinds of initial 1-order Hilbert curves, as shown in Figure 6.
Taking the initial curves (1) and (5) in Figure 6 as an example, and using the Hilbert curve generation algorithm based on matrix operations [22], two 5th-order Hilbert curves (32 × 32) are obtained in Figure 7. It can be seen that the traversal modes of higher-order curves obtained from different initial curves are quite different. Therefore, eight 1st-order curves can provide eight different data processing schemes during image encryption.

3. Image Encryption Algorithm

3.1. Key Sequence

In order to better resist the chosen plaintext attack, this section uses the SHA-512 algorithm to obtain the hash value of the plaintext image to scramble the initial value. The hash value contains 512 bits, dividing into 64 integers, each integer containing 8 bits, and it is given in the form of a matrix described as:
H = [ h 1 h 2 h 3 h 4 h 5 h 6 h 7 h 8 .. .. .. .. h 61 h 62 h 63 h 64 ] .
Matrix H is further processed to obtain [k1, k2, k3, k4] for (8). Specifically, take the first row of the matrix [h1, h2, h3, h4]. If the first element of the next line is an even number, perform the exclusive OR (XOR) operation with its corresponding element; if the first element of the next line is an odd number, first flip the next line left and right, and then perform the XOR operation with the corresponding element. Its formula description is shown in (10).
[ k 1 , k 2 , k 3 , k 4 ] = { l i l i + 1 mod ( a i , 2 ) = 0 l i ( l i + 1 ) mod ( a i , 2 ) 0 ,
where, li is the ith row, li′ is obtained by flipping the ith row left and right, ai is the first element of the ith row.
Then substituting [k1, k2, k3, k4] into (11) to get the initial values [x0, y0, z0, w0] of the discrete hyper-chaotic system.
{ x 0 = 0.1 + k 1 / 255 y 0 = 0.1 + k 2 / 255 z 0 = 0.1 + k 3 / 255 w 0 = 0.1 + k 4 / 255
The iteration number of the discrete system is set to M × N × O + L, and the hyper-chaotic sequence [X, Y, Z, W] is obtained. Among them, M is the number of rows of pixels, N is the number of columns of pixels, O is the number of channels of pixels, and ‘×’ presents multiplication operation. Selecting M, N, and O makes the length of the hyper-chaotic sequence match the scale of the image data, which can improve the encryption efficiency. In addition, according to the analysis above, it takes a time for the hyper-chaotic system to reach the synchronous state, so the number before reaching the synchronous state needs to be discarded. L = 60,000 represents the iteration number to be discarded.
Finally, (12) is used to preprocess the hyper-chaotic sequence. Taking X and Z as an example, the key sequences Sr, Sc and Sz are obtained.
{ S r = mod ( f l o o r ( X × 10 15 ) , N ) + 1 S c = mod ( f l o o r ( X × 10 14 ) , M ) + 1 S z = mod ( f l o o r ( Z × 10 15 ) , 256 ) ,
where, floor(·) indicates the floor function, Sr is used for the permutation operation of the row pixels, Sc is used for the permutation operation of the column pixels, and Sz will be used for the diffusion operation of the pixels.

3.2. Permutation

This subsection uses the index sequence of the Hash table to perform pixel-level permutation of the image, and combines bit-level permutation to achieve a double permutation effect. Since row operations are similar to column operations, we will take row operations as an example for detailed description.
The pixel-level permutation process is described as follows:
Step 1: According to the scale of the image data, the key sequence Sr in (12) is processed into blocks Sr = {Sr1, Sr2, Sr3, …, SrM×O}, corresponding to the permutation operation of each row.
Step 2: Use the Hash table structure to process the segmented key sequence to obtain an index sequence xr = {xr1, xr2, xr3, …, xrM×O} without repeated values.
Step 3: The pixel-level permutation is performed on each row of pixels using the index sequence xr, as shown in (13).
{ x = x r j ( i ) A j ( x ) = P j ( i ) ,
where, j = 1, 2, 3, …, M × N × O, represents the jth row sequence, i = 1, 2, 3, …, N, represents the ith element of the sequence. x’ is the new index value, P is the row pixel of the plaintext image, and A is the new row pixel.
After the pixel-level permutation of each row is completed, the bit-level permutation of the row is carried out immediately. The bit-level permutation process is following:
For the first row pixels, the process is described as:
{ t = mod ( x r 1 ( 1 ) , 8 ) B 1 = circshift ( A 1 , t ) .
Step 1: Take out the first index value xr1(1) corresponding to the row, and perform modulo operation on 8 to obtain the number of bits in the cyclic shift.
Step 2: A bit-level cyclic shift is performed on each pixel of the row.
For the jth row pixels (j ≠ 1), the process is described as:
{ s = mod ( x r j ( 1 ) , 256 ) s = s B j 1 ( x r j ( 1 ) ) t = mod ( s , 8 ) B j = circshift ( A j , t ) .  
Step 1: Use the first index value xrj(1) to perform the modulo operation on 256, and the obtained result is XORed with the pixel corresponding to the index value in the previous row. Then take the XOR result and perform the modulo operation on 8 to obtain the number of bits in the circular shift.
Step 2: A bit-level cyclic shift is performed on the pixels.
Combining the above two permutation algorithms to traverse each row of pixels, the row permutation operation is completed. The column operation is similar to the row operation, the difference is that the key sequence used in the column operation is Sc in (12).

3.3. Diffusion

This subsection uses the elements of the Hilbert curve matrix as an index to reorder the key sequence Sz in (12), and use the new sequence for the diffusion operation.
Step 1: Determine the order of the Hilbert curve according to the scale of the image data. If the image size is M × N × O, the required order can be calculated by (16).
{ s = log 2 ( max ( M , N ) ) e = c e i l ( s ) + 1 ,
where ceil(·) indicates ceiling function and e is the order of the Hilbert curve.
Step 2: Choose an initial curve from Figure 6. Specifically, take out the first number of Sz and perform modulo operation on 8, and add 1 to the result to obtain an integer from 1 to 8, corresponding to the eight initial curves in Figure 6.
Step 3: After the e-order Hilbert curve is obtained from the initial curve, its traversal matrix is converted into a sequence H with a size of 1 × 4e. Discard the elements larger than M × N × O in H to obtain the index sequence, use the index sequence to reorder Sz, and obtain a new sequence Sh for the diffusion operation.
Step 4: The diffusion operation is performed based on the method of ciphertext feedback. We only take row operation as an example shown in (17), because the row and column operations for diffusion encryption are similar.
C j = { P j S h j j = 1 P j C j 1 S h j j 1 ,
where j represents the jth row, Shj is the subsequence of Sh, P is the plaintext sequence, and Cjis the ciphertext sequence.

3.4. Encryption and Decryption Process

The flow chart of the algorithm is shown in Figure 8, and the colored Lena image is selected as the plaintext image P. The specific steps of image encryption are as follows:
Step 1: Use the SHA-512 algorithm to get the initial value [x0, y0, z0, w0] with plaintext information.
Step 2: Generate the key sequences Sr, Sc and Sz through the iteration of the hyper-chaotic system.
Step 3: Processing the repeated values of Sr and Sc to obtain the Hash table index sequence xr and xc, which are used for row operation and column operation respectively.
Step 4: Use the traversal matrix of the Hilbert curve to reorder the sequence Sz to obtain the sequence Sh.
Step 5: Use xr to perform the pixel-level permutation on the pixels of each row, then perform the bit-level permutation of the row, and then use Sh to perform the diffusion operation on the row.
Step 6: Use a similar operation on the column pixels, and the ciphertext C is obtained.
Furthermore, the decryption process is the inverse of the encryption process, as shown on the right side of Figure 8. It is worth pointing out that the encryption end needs to transmit the hyper-chaotic sequence Y as the driving sequence to the decryption end, and then the decryption end obtains the same key sequence as the encryption end through chaotic synchronization. The whole process does not need to transmit the initial key, and the Y does not belong to the key sequence. Therefore, the attacker cannot steal the key information through the public channel.

3.5. Experimental Results

The color Lena image with a size of 256 × 256 is selected as the test image, and the simulation results are shown in Figure 9. The ciphertext pixels are irregular, and the decrypted image is consistent with the plaintext. This shows that the encryption algorithm can hide the plaintext information well, to ensure that the information will not be stolen, and all the information of the plaintext can be recovered through the decryption operation.

4. Security Analysis

4.1. Key Space

A suitable encryption algorithm should have a key space large enough to prevent cracking. The algorithm proposed in this paper selects the initial value and system parameters of the discrete hyper-chaotic system as the key, namely [x0, y0, z0, w0, a, b, c, d]. When the parameter a varies between [10,15] and c varies between [−2, −1.5], the system has hyper-chaotic properties. In addition, the initial values of x0, y0, z0 and w0 between [–10,10] can all produce hyper-chaos. Assuming that the calculation precision is 10−15, the key space is at least: 5 × 1015 × 0.5 × 1015 × (20 × 1015)4 = 4 × 1095, which is much larger than the standard value of 2100.

4.2. Key Sensitivity

Key sensitivity means that when the key changes slightly, the encrypted image will change greatly. Similarly, if there is a slight difference between the decryption key and the encryption key, it will not decrypt correctly. In addition, under the condition of chaotic synchronization, the system parameters will determine whether the decryption is successful or not. Therefore, in order to test the sensitivity of the key, we individually make small changes to each parameter in the decryption key to get the wrong key. Taking parameter a as an example, let a′ = a + 10−15, and other conditions remain unchanged, the decryption result is shown in the Figure 10b.
Comparing Figure 10a,b, it can be seen that the algorithm is extremely sensitive to the parameter a. Similarly, we also tested the sensitivity of the algorithm to other parameters. The results are shown in Table 1, indicating that the proposed algorithm has strong key sensitivity.

4.3. Information Entropy

Information entropy reflects the distribution characteristics of pixel values, and can be used to measure the randomness of image information, which can be obtained from (18).
H ( s ) = i = 1 N 0 p ( s i ) log 2 p ( s i ) ,
where, H(s) is the information entropy, si is the pixel value, N0 = 256 is the number of pixel values, and p(si) is the probability that the pixel value si appears. When all p(si) are equal to 1/256, the information entropy reaches a maximum value 8.
We calculated the information entropy of the color image after encryption, as shown in Table 2. Then we compared with other existing algorithms using gray images, as shown in Table 3. The data show that the information entropy obtained by the proposed algorithm is very close to the highest value of 8, and is larger than the results of other algorithms, so the algorithm has high security.

4.4. Histogram Analysis

In order to prevent attackers from cracking the algorithm through statistical analysis, the pixel values of the ciphertext need to be uniformly distributed and its histogram is smooth and continuous. Figure 11 presents the histograms of plaintext and ciphertext, where abscissa axis indicates pixels from 0 to 255 and ordinate axis indicates the number of times each pixel appearing in each picture.
Obviously, the histogram of the ciphertext is smooth and continuous, indicating that its pixel values are evenly distributed. Therefore, an attacker cannot decrypt using statistical analysis.

4.5. Correlation Analysis

Usually, there is a strong correlation between adjacent pixels. The encryption algorithms should try to minimize this correlation to prevent cracking. This section randomly selects 10,000 pairs of adjacent pixels, and calculates the correlation between adjacent pixels in the horizontal, vertical and diagonal directions of the plaintext and ciphertext by (19).
{ E ( x p ) = 1 N p i = 1 N p x p i D ( x p ) = 1 N p i = 1 N p ( x p i E ( x p ) ) 2 cov ( x p , y p ) = 1 N p i = 1 N p ( x i E ( x p ) ) ( y i E ( y p ) ) ρ x y = cov ( x p , y p ) D ( x p ) D ( y p ) ,
where, xp and yp are adjacent pixels, Np = 10,000 represents the number of randomly selected pixel pairs, ρxy is the correlation coefficient.
The calculation results are shown in Table 4. Obviously, the pixel correlation coefficient of the ciphertext is close to 0 and has almost no correlation. For a more intuitive display, we count the pixel values in the horizontal, vertical and diagonal directions, and draw a scatter plot, as shown in Figure 12. In the ciphertext, the distribution of pixel values of adjacent pixels is similar to random, which has strong anti-statistical attack ability.

4.6. Differential Analysis

In the differential attack process, the attacker makes small changes to the plaintext, and then compares the differences between the ciphertexts to obtain key information to crack the algorithm.
In order to test anti-differential attack ability of the algorithm, this subsection adopts the Number of Pixels Change Rate (NPCR) and the Unified Average Changing Intensity (UACI) used in [26]. When a single pixel of plaintext changes, the NPCR represents the change rate of ciphertext pixels, and the ideal value is 99.6049%. UACI represents the change intensity of the ciphertext pixel value, and the ideal value is 33.4635%, as shown in (20).
{ NPCR = i , j , k = 1 M , N , O D ( i , j , k ) M × N × O × 100 % UACI = 1 M × N × O [ i , j , k = 1 M , N , O | C 1 ( i , j , k ) C 2 ( i , j , k ) | 255 ] × 100 % D ( i , j , k ) = { 0 , C 1 ( i , j , k ) = C 2 ( i , j , k ) 1 , C 1 ( i , j , k ) C 2 ( i , j , k ) ,
where, M × N × O is the image size, and C1(i,j,k) and C2(i,j,k) represent the pixel values of the two ciphertexts at coordinates (i,j,k), respectively.
To avoid the chance of the result, we randomly select 100 pixels in the plaintext and change the value of one pixel each time. 100 sets of results were obtained and plotted as a graph, as shown in Figure 13. Obviously, the value of NPCR fluctuates around 99.6%, and the value of UACI fluctuates around 33.46%, which are very close to their ideal values, indicating that the proposed algorithm has strong resistance to differential attacks.

4.7. Robustness Analysis

During the transmission and storage of ciphertext, external interference factors can damage the image. Therefore, the encryption algorithm should have certain robustness to resist the influence caused by uncertain factors.
In order to test the robustness of the algorithm, this section uses occlusion attack and Salt & Pepper noise attack to process the ciphertext, and analyzes the impact of the attack on decryption. The experimental results are shown in Figure 14 and Figure 15.
It can be seen from Figure 14 and Figure 15 that when the ciphertext is damaged, such as occlusion attacks and noise attacks, most of the plaintext data can still be recovered through decryption. Therefore, the proposed algorithm has strong robustness.

4.8. Speed Analysis

In addition to security, speed is also an important factor in algorithm performance. The proposed algorithm traverses each row and column in the permutation-diffusion processes, and only operates one pixel at a time in the permutation process, so the time complexity is O(n2). Table 5 presents the comparison of the proposed algorithm with other existing algorithms in terms of encryption time.
It can be seen that when the image size increases, the encryption speed will be significantly reduced due to the increased amount of data. In addition, under the condition of the same image size, the proposed algorithm has certain advantages in encryption speed compared with other algorithms. In conclusion, the proposed algorithm has high efficiency and is more conducive to practical applications.

5. Conclusions

In this paper, a new image encryption algorithm is designed based on the discrete system, which is obtained from a tri-valued memristor-based hyper-chaotic system we built before, the key transmission is realized based on hyper-chaotic synchronization method. Firstly, the initial key of the proposed algorithm contains the Hash value of the original image, which makes the algorithm have high plaintext sensitivity. Secondly, the algorithm implements double permutation encryption based on pixel-level and bit-level, and uses the index sequence generated based on the Hash table in the pixel-level permutation, which has high randomness and improves the permutation effect. Thirdly, the algorithm uses the Hilbert curve to reorder the key sequence, and combines the ciphertext feedback method to design the diffusion operation, which makes the relationship between the plaintext, ciphertext and key more complicated. Finally, the security performance of the proposed algorithm is analyzed, such as key space, key sensitivity, anti-attack ability and algorithm robustness. The results show that the proposed algorithm has both high security and high efficiency. Therefore, the algorithm has high theoretical and application value.

Author Contributions

Conceptualization, X.W., X.Z. and M.G.; methodology, X.W. and M.G.; validation, X.W., X.Z. and Y.T.; formal analysis, M.G. and X.Z.; investigation, X.Z., Y.T. and M.G.; resources, X.Z. and M.G.; writing—original draft preparation, M.G.; writing—review and editing, X.W. and X.Z.; supervision, X.W., H.H.-C.I. and C.W.; project administration, X.W.; funding acquisition, X.W. All authors have read and agreed to the published version of the manuscript.

Funding

This research was funded by the [National Natural Science Foundation of China] grant number [61871429], and the [Natural Science Foundation of Zhejiang Province] grant number [LY18F010012].

Institutional Review Board Statement

Not applicable.

Informed Consent Statement

Not applicable.

Data Availability Statement

The datasets generated and analyzed during the current study are available from the corresponding author on reasonable request.

Conflicts of Interest

The authors declare no conflict of interest.

References

  1. Hua, Z.; Xu, B.; Jin, F.; Huang, H. Image encryption using Josephus problem and filtering diffusion. IEEE Access 2019, 7, 8660–8674. [Google Scholar] [CrossRef]
  2. Hua, Z.; Zhu, Z.; Chen, Y.; Li, Y. Color image encryption using orthogonal Latin squares and a new 2D chaotic system. Nonlinear Dyn. 2021, 104, 4505–4522. [Google Scholar] [CrossRef]
  3. Zhou, Y.; Li, C.; Li, W.; Li, H.; Feng, W.; Qian, K. Image encryption algorithm with circle index table scrambling and partition diffusion. Nonlinear Dyn. 2021, 103, 2043–2061. [Google Scholar] [CrossRef]
  4. Tang, H.; Sun, Q.; Yang, X.; Long, K. A network coding and DES based dynamic encryption scheme for moving target defense. IEEE Access 2018, 6, 26059–26068. [Google Scholar] [CrossRef]
  5. Masoumi, M. Novel hybrid CMOS/memristor implementation of the AES algorithm robust against differential power analysis attack. IEEE Trans. Circuits Syst. II Express Briefs 2020, 67, 1314–1318. [Google Scholar] [CrossRef]
  6. Li, C.; Luo, G.; Qin, K.; Li, C. An image encryption scheme based on chaotic tent map. Nonlinear Dyn. 2017, 87, 127–133. [Google Scholar] [CrossRef]
  7. Sun, S. A novel hyperchaotic image encryption scheme based on DNA encoding, pixel-level scrambling and bit-level scrambling. IEEE Photonics J. 2018, 10, 7201714. [Google Scholar] [CrossRef]
  8. Zhu, S.; Zhu, C. Plaintext-related image encryption algorithm based on block structure and five-dimensional chaotic map. IEEE Access 2019, 7, 147106–147118. [Google Scholar] [CrossRef]
  9. Li, H.; Deng, L.; Gu, Z. A robust image encryption algorithm based on a 32-bit chaotic system. IEEE Access 2020, 8, 30127–30151. [Google Scholar] [CrossRef]
  10. El-Khamy, S.; Mohamed, A. An efficient DNA-inspired image encryption algorithm based on hyper-chaotic maps and wavelet fusion. Multimed. Tools Appl. 2021, 80, 23319–23335. [Google Scholar] [CrossRef]
  11. Wen, H.; Zhang, C.; Chen, P.; Chen, R.; Xu, J.; Liao, Y.; Liang, Z.; Shen, D.; Zhou, L.; Ke, J. A quantum chaotic image cryptosystem and its application in IoT secure communication. IEEE Access 2021, 9, 20481–20492. [Google Scholar] [CrossRef]
  12. Wang, X.; Yu, J.; Jin, C.; Iu, H.H.-C.; Yu, S. Chaotic oscillator based on memcapacitor and meminductor. Nonlinear Dyn. 2019, 96, 161–173. [Google Scholar] [CrossRef]
  13. Min, X.; Wang, X.; Zhou, P.; Yu, S.; Iu, H.H.-C. An optimized memristor-based hyperchaotic system with controlled hidden attractors. IEEE Access 2019, 7, 124641–124646. [Google Scholar] [CrossRef]
  14. Lin, H.; Wang, C.; Xu, C.; Iu, H.H.-C. A memristive synapse control method to generate diversified multi-structure chaotic attractors. IEEE Trans. Comput.-Aided Des. Integr. Circuits Syst. 2022. [Google Scholar] [CrossRef]
  15. Lin, H.; Wang, C.; Sun, Y.; Wang, T. Generating n-scroll chaotic attractors from a memristor-based magnetized hopfield neural network. IEEE Trans. Circuits Syst. II Express Briefs 2023, 70, 311–315. [Google Scholar] [CrossRef]
  16. Lin, H.; Wang, C.; Cui, L.; Sun, Y.; Xu, C.; Yu, F. Brain-like initial-boosted hyperchaos and application in biomedical image encryption. IEEE Trans. Ind. Inform. 2022, 18, 8839–8850. [Google Scholar] [CrossRef]
  17. Lin, H.; Wang, C.; Cui, L.; Sun, Y.; Zhang, X.; Yao, W. Hyperchaotic memristive ring neural network and application in medical image encryption. Nonlinear Dyn. 2022, 110, 841–855. [Google Scholar] [CrossRef]
  18. Wang, X.; Zhang, X.; Gao, M. A novel voltage-controlled tri-valued memristor and its application in chaotic system. Complexity 2020, 2020, 6949703. [Google Scholar] [CrossRef]
  19. Wang, X.; Gao, M.; Iu, H.H.-C.; Wang, C. Tri-valued memristor-based hyper-chaotic system with hidden and coexistent attractors. Chaos Solitons Fractals 2022, 159, 112177. [Google Scholar] [CrossRef]
  20. Brindha, M.; Gounden, N.A. A chaos based image encryption and lossless compression algorithm using hash table and Chinese remainder theorem. Appl. Soft Comput. 2016, 40, 379–390. [Google Scholar] [CrossRef]
  21. Wang, X.; Liu, L. Image encryption based on hash table scrambling and DNA substitution. IEEE Access 2020, 8, 68533–68547. [Google Scholar] [CrossRef]
  22. Alvarez, G.; Li, S. Some basic cryptographic requirements for chaos-based cryptosystems. Int. J. Bifurc. Chaos 2006, 16, 2129–2151. [Google Scholar] [CrossRef] [Green Version]
  23. Zhao, J.; Wang, S.; Zhang, L.; Wang, X. Image encryption algorithm based on a novel improper fractional-order attractor and a wavelet function map. J. Electr. Comput. Eng. 2017, 2017, 8672716. [Google Scholar] [CrossRef] [Green Version]
  24. Zhang, X.; Zhou, Z.; Niu, Y. An image encryption method based on the Feistel network and dynamic DNA encoding. IEEE Photonics J. 2018, 10, 3901014. [Google Scholar] [CrossRef]
  25. Premkumar, R.; Anand, S. Secured and compound 3-D chaos image encryption using hybrid mutation and crossover operator. Multimed. Tools Appl. 2019, 78, 9577–9593. [Google Scholar] [CrossRef]
  26. Wang, X.; Gao, M.; Min, X.; Lin, Z.; Iu, H.H.-C. On the use of memristive hyperchaotic system to design color image encryption scheme. IEEE Access 2020, 8, 182240–182248. [Google Scholar] [CrossRef]
  27. Huang, H. Novel scheme for image encryption combining 2D Logistic-Sine-Cosine map and double random-phase encoding. IEEE Access 2019, 7, 177988–177996. [Google Scholar] [CrossRef]
Figure 1. Phase diagram of discrete system, (a) x-y plane, (b) x-z plane, (c) x-w plane.
Figure 1. Phase diagram of discrete system, (a) x-y plane, (b) x-z plane, (c) x-w plane.
Mathematics 11 00567 g001
Figure 2. Error curves, (a) ex, (b) ey, (c) ez, (d) ew.
Figure 2. Error curves, (a) ex, (b) ey, (c) ez, (d) ew.
Mathematics 11 00567 g002
Figure 3. Hash table data structure.
Figure 3. Hash table data structure.
Mathematics 11 00567 g003
Figure 4. Handling repeated values in sequence x S  
Figure 4. Handling repeated values in sequence x S  
Mathematics 11 00567 g004
Figure 5. nth-order Hilbert curve, (a) n = 1, (b) n = 2.
Figure 5. nth-order Hilbert curve, (a) n = 1, (b) n = 2.
Mathematics 11 00567 g005
Figure 6. Eight 1-order Hilbert curves.
Figure 6. Eight 1-order Hilbert curves.
Mathematics 11 00567 g006
Figure 7. Two 5th-order Hilbert curves with different initial curves, (a) curve (1), (b) curve (5).
Figure 7. Two 5th-order Hilbert curves with different initial curves, (a) curve (1), (b) curve (5).
Mathematics 11 00567 g007
Figure 8. Flowchart of algorithm.
Figure 8. Flowchart of algorithm.
Mathematics 11 00567 g008
Figure 9. Experimental results, (a) plaintext, (b) ciphertext, (c) decrypted image.
Figure 9. Experimental results, (a) plaintext, (b) ciphertext, (c) decrypted image.
Mathematics 11 00567 g009
Figure 10. Key sensitivity test, (a) correct key, (b) wrong key.
Figure 10. Key sensitivity test, (a) correct key, (b) wrong key.
Mathematics 11 00567 g010
Figure 11. Histogram, (ac) Histogram of plaintext, (df) Histogram of ciphertext.
Figure 11. Histogram, (ac) Histogram of plaintext, (df) Histogram of ciphertext.
Mathematics 11 00567 g011
Figure 12. Distribution of pixels, (a) Horizontal direction of the plaintext, (b) Vertical direction of the plaintext, (c) Diagonal direction of the plaintext, (d) Horizontal direction of the ciphertext, (e) Vertical direction of the ciphertext, (f) Diagonal direction of the ciphertext.
Figure 12. Distribution of pixels, (a) Horizontal direction of the plaintext, (b) Vertical direction of the plaintext, (c) Diagonal direction of the plaintext, (d) Horizontal direction of the ciphertext, (e) Vertical direction of the ciphertext, (f) Diagonal direction of the ciphertext.
Mathematics 11 00567 g012
Figure 13. Differential attack test, (a) NPRC, (b) UACI.
Figure 13. Differential attack test, (a) NPRC, (b) UACI.
Mathematics 11 00567 g013
Figure 14. Occlusion test, (a,d) Occlusion 32 × 32 pixels, (a,d) Occlusion 64 × 64 pixels, (c,f) Occlusion 128 × 128 pixels.
Figure 14. Occlusion test, (a,d) Occlusion 32 × 32 pixels, (a,d) Occlusion 64 × 64 pixels, (c,f) Occlusion 128 × 128 pixels.
Mathematics 11 00567 g014
Figure 15. Salt & Pepper noise test, (a,d) noise density: 0.01, (a,d) noise density: 0.05, (c,f) noise density: 0.1.
Figure 15. Salt & Pepper noise test, (a,d) noise density: 0.01, (a,d) noise density: 0.05, (c,f) noise density: 0.1.
Mathematics 11 00567 g015
Table 1. Key sensitivity test.
Table 1. Key sensitivity test.
Parameterabcd
Sensitivity10−1510−1510−1510−14
Table 2. Information entropy test.
Table 2. Information entropy test.
ImageInformation Entropy
Channel RChannel GChannel B
Lena7.98967.98927.9897
Table 3. Comparison of gray images.
Table 3. Comparison of gray images.
AlgorithmInformation Entropy
Proposed7.9895
Ref. [23]7.9888
Ref. [24]7.9890
Ref. [25]7.9240
Table 4. Correlation coefficient of adjacent pixels.
Table 4. Correlation coefficient of adjacent pixels.
DirectionPlaintextCiphertext
Horizontal0.96710.0007
Vertical0.9383−0.0031
Diagonal0.92270.0011
Table 5. Comparison of encryption times.
Table 5. Comparison of encryption times.
AlgorithmSizeTime
Proposed256 × 2560.5726
512 × 5122.0181
Ref. [21]256 × 2560.7091
Ref. [27]256 × 2561.9140
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.

Share and Cite

MDPI and ACS Style

Wang, X.; Zhang, X.; Gao, M.; Tian, Y.; Wang, C.; Iu, H.H.-C. A Color Image Encryption Algorithm Based on Hash Table, Hilbert Curve and Hyper-Chaotic Synchronization. Mathematics 2023, 11, 567. https://doi.org/10.3390/math11030567

AMA Style

Wang X, Zhang X, Gao M, Tian Y, Wang C, Iu HH-C. A Color Image Encryption Algorithm Based on Hash Table, Hilbert Curve and Hyper-Chaotic Synchronization. Mathematics. 2023; 11(3):567. https://doi.org/10.3390/math11030567

Chicago/Turabian Style

Wang, Xiaoyuan, Xinrui Zhang, Meng Gao, Yuanze Tian, Chunhua Wang, and Herbert Ho-Ching Iu. 2023. "A Color Image Encryption Algorithm Based on Hash Table, Hilbert Curve and Hyper-Chaotic Synchronization" Mathematics 11, no. 3: 567. https://doi.org/10.3390/math11030567

Note that from the first issue of 2016, this journal uses article numbers instead of page numbers. See further details here.

Article Metrics

Back to TopTop