An Optical Image Encryption Method Using Hopfield Neural Network

In this paper, aiming to solve the problem of vital information security as well as neural network application in optical encryption system, we propose an optical image encryption method by using the Hopfield neural network. The algorithm uses a fuzzy single neuronal dynamic system and a chaotic Hopfield neural network for chaotic sequence generation and then obtains chaotic random phase masks. Initially, the original images are decomposed into sub-signals through wavelet packet transform, and the sub-signals are divided into two layers by adaptive classification after scrambling. The double random-phase encoding in 4f system and Fresnel domain is implemented on two layers, respectively. The sub-signals are performed with different conversions according to their standard deviation to assure that the local information’s security is guaranteed. Meanwhile, the parameters such as wavelength and diffraction distance are considered as additional keys, which can enhance the overall security. Then, inverse wavelet packet transform is applied to reconstruct the image, and a second scrambling is implemented. In order to handle and manage the parameters used in the scheme, the public key cryptosystem is applied. Finally, experiments and security analysis are presented to demonstrate the feasibility and robustness of the proposed scheme.


Introduction
In the development of digital technology and computer industry, the requirements for information confidentiality has attracted increasing attention. In order to provide protection to multimedia applications, many algorithms have been developed during the past several decades. The application of optical methods in information security has become a hot trend due to its inherent capabilities of parallel processing [1][2][3][4][5]. The classic double randomphase encoding was proposed based on an optical Fourier transform system. Subsequently, a large number of approaches have been developed to searching for other types of optical encryption methods in different domains, such as fractional Fourier domain [6][7][8], Fresnel domain [9,10] and gyrator domain [11]. However, due to inherent symmetry and linearity, the security of such cryptosystems is greatly affected [12,13]. During the process of optical image encryption, it is necessary not only to conceal the information of whole image, but also to selectively encrypt the important information, so as to improve local security. In addition, considering the characteristics of chaotic systems (i.e., sensitivity to initial values, deterministic dynamics, nonlinear transformation and pseudo-randomness) [14,15], applying chaotic systems to optical image encryption may have a positive impact on the overall security.
Hopfield neural network, proposed for the first time by Hopfield in 1982 [16], is a typical dynamic neural network which has been applied in information processing and engineering, such as associative memory [17] and optimization problems [18]. It is worth noting that the Hopfield neural network plays a crucial role in neuro-computing due to its similarity to brain dynamics [19], and the complex behaviors and properties of the Hopfield neural network have been investigated [20][21][22][23]. As more and more research is done to combine chaos theory and information security, neural networks have become a vital method to be considered in image encryption. Particularly, a Hopfield neural network with chaos can greatly improve the space-time complexity of an encryption scheme through outstanding nonlinear and associative memory effects [24][25][26][27]. However, few studies have integrated the Hopfield neural network and optical methods to enhance the security of information.
In recent years, chaotic systems have been combined with different cryptosystems and technologies for image encryption, such as compression sensing [28,29] and DNA [30,31]. The combination has been proved to effectively improve the key space and the stability of encryption algorithms [32,33], and plenty of simple chaotic systems (e.g., logistic map and sine map) have been applied due to uncomplicated structure [34][35][36]. Nevertheless, the security of optical image encryption cannot be improved by using simple chaotic systems on account of their structure and insufficient parameters. Moreover, the sensitivity to computer precision may cause the systems to degenerate into non-chaotic systems immediately [37]. The single neuronal dynamic system was derived from the Hopfield neural network by Xu et al. in 2021 [38]. The system has sufficient parameters and complex chaotic dynamical behavior, whereas chaos cannot always be maintained in the interval of some parameters. Fuzzy numbers have a large field of study with applications in dynamical systems, which promote the systems to present many chaos-related phenomena [39][40][41]. The single neuronal dynamic system also has the applicability to combine with fuzzy numbers to further enhance the stability and chaotic phenomena.
In this paper, a chaotic Hopfield neural network and fuzzy single neuronal dynamic system are combined with a hybrid optical method to construct a new encryption method. In this scheme, the input image is decomposed into sub-signals through wavelet packet transform, and the sub-signals are divided into two layers by adaptive classification after scrambling. The chaotic random-phase masks are constructed by chaotic sequences. The first layer of sub-signals is encrypted by double random phase encoding (DRPE) in 4f system, and the second layer is encrypted by double random phase encoding in Fresnel domain. After inverse wavelet packet transform, the obtained image is secondarily scrambled. In addition, the keys used in the process of encryption are integrated and hidden by RSA cryptosystem. Finally, simulation experiments demonstrate the feasibility and security of the proposed method.

Fuzzy Single Neuronal Dynamical System
The single neuronal dynamical system in Hopfield neural network was proposed by Xu et al. in 2021 [38]. The mathematical model of the system is described as follows: where γ, k, z, h and n are system parameters. The robustness and sensitivity of single neuronal dynamical system has been verified in [38]. However, the performance of single neuronal dynamical system can be further improved by using fuzzy numbers.
In this work, we consider the triangular form of fuzzy number as Equation (2), and the full presentation of fuzzy number can be found in [42][43][44].
where s is the peak of the triangular fuzzy number.
We propose partitioning single neuronal dynamical system by combining it with the triangular form of fuzzy number to generate fuzzy single neuronal dynamical system fuzzy single neuronal dynamic system, as shown in Equation (3).
Considering s = 0.1, the Lyapunov exponent evolution comparison between the single neuronal dynamical system and the fuzzy single neuronal dynamic system is performed, as shown in Figures 1-5. It can be seen that the stability of the fuzzy single neuronal dynamic system and the interval in the chaotic state are significantly increased. For parameter γ, Figure 1 shows the instances of entering the chaotic state at γ > 132.8 and γ < −25.3, which indicates there are larger chaos intervals on the both sides of the zero point. A similar phenomenon is also observed in parameters k and z. For parameter n, as shown in Figure 4, its Lyapunov exponent fluctuates more smoothly, which is similar to parameters k and z.

Hopfield Chaotic Neural Network
This paper considers a 3-neuron Hopfield network of the form: ] T , and synaptic weight matrix is: When the 3-neuron Hopfield network applies the weight matrix, the system can display chaotic behavior. The dynamic behavior of the chaotic Hopfield network is complex and suitable for image encryption. Figure 6 demonstrates the phrase portrait of the network with the initial state [0.1, 0.1, 0.1], which shows a double-scroll chaotic attractor.

Public Key Cryptosystem
The RSA public key cryptosystem was proposed by Rivest et al. [45] in 1978, and its implementation depend on the difficulty of large integer decomposition. In RSA, users have their own public key (N, e) and private key d. The key generation process is described as follows: • Two large prime numbers (i.e., p and q) are generated randomly, and p = q.

•
The key N and Euler function ϕ(N) are calculated as Equations (7) and (8): • An integer number e is generated as one of public keys obeyed Equations (9) and (10): gcd(e, ϕ(N)) = 1 (10) where, gcd denotes the great common divisor. • Then, d is calculated as Equation (11) as private key: where mod denotes the modulo operation.
After obtaining public key and private key, the plaintext is divided into multiple groups, each of which is a decimal number m of bit length less than N. The encryption operation can be described as Equation (12): where C represents the ciphertext. The decryption operation is performed as Equation (13):

Encryption Steps
In this paper, an optical image encryption algorithm based on Hopfield neural network is proposed, as shown in Figure 7. To enhance the level of security, we use wavelet packet transform to decompose and filter the signal. Then, there are two layers in the subsequent encryption process. The DRPE method is applied to two layers through 4f system and Fresnel transform, respectively. Furthermore, RSA cryptosystem is performed for keysequence management. It should be noted that there is no specific method and limitation for random matrix construction in the traditional DRPE. Thus, we construct random-phase masks to encrypt the decomposed signal by different chaotic sequences. The detail of the process is described in Figure 7. Suppose the size of plaintext image is M × N, where M is the length of the row and N is the length of the column.
Step 1: The plaintext image is decomposed using m order wavelet packet transform, and sub-signals are obtained. Each sub-signal has a corresponding number, ranging from 1 to T. Set x 1 (1), x 2 (1), x 3 (1) as the initial values of the Hopfield chaotic neural network, and the M × N times iteration is performed to get three sequences.
Step 3: The sequence X 1 is divided into subsequences [L1, L2, . . . , LT], and each subsignal is converted into a 1D matrix [P1, P2, . . . , PT]. Sort each sequence L in ascending order, and matrix P is obtained according to the sorting result. The process is shown in Figure 8. Then, P is converted back to a 2D matrix. Step 4: The standard deviation σ t of each scrambled sub-signal is calculated, and the mean of [σ 1 , . . . , σ t , . . . , σ T ] is obtained. If σ t ≥ σ mean , the sub-signal is assigned to the first layer. If σ t < σ mean , the sub-signal is assigned to the second layer.
Step 5: The sequence X 2 and X 3 is divided into subsequences numbered from 1 to T, respectively. Each subsequence is converted into matrix with the size of sub-signal. Then, perform Arnold scrambling on each chaotic matrix as in Equation (15): where (x, y) is the original coordinate, (x , y ) is the scrambled coordinate.
Step 6: After Arnold scrambling, normalize each matrix from X 2t to obtain chaotic random matrix g t (x, y), and normalize each matrix from X 3t to obtain chaotic random matrix r t (x, y). Then construct chaotic random phase: Step 7: Perform DRPE of 4f system on sub-signals of the first layer as in Equation (18). Then, DRPE of Fresnel transform is performed on sub signals of the second layer as in Equation (19): where (x, y) is the original coordinate of sub-signal, (x , y ) is the coordinate after DRPE in 4f system or Fresnel transform, ρ and is the incident light wavelength, d 1 and d 2 represent the diffraction distance. FT[·] and FT −1 [·] represent Fourier transform and inverse Fourier transform, respectively. FrT[·] represents Fresnel transform.
Step 8: Sub-signals are transformed into M × N matrix E by m order inverse wavelet packet transform. Then, the complex-value matrix E is normalized.
Step 9: u 0 , γ, k, z, h, n and s are initial value and system parameters of fuzzy single neuronal dynamic system, therefore they are used as key sequence. Iterate fuzzy single neuronal dynamic system M × N times, and a chaotic sequence V is obtained. This sequence is used to scramble matrix E to obtain an encrypted image; the process is the same as Step 3.
The keys used in the process of encryption are divided into three sequences. The first sequence includes initial values of chaotic Hopfield neural network and parameters of Arnold scrambling (i.e., x 1 (1), x 2 (1), x 3 (1), α, β). The second sequence consists of initial value and system parameters of fuzzy single neuronal dynamic system (i.e., u 0 , γ, k, z, h, n, s). The third sequence is composed of wavelet packet transform order, incident light wavelength and diffraction distance (i.e., m, ρ, d 1 , d 2 ). The ciphertext sequences are obtained by RSA cryptosystem using public keys N and e.

Image Decryption
In this work, keys used in the scheme are integrated and hidden by an RSA cryptosystem. Thus, the process of decryption can be performed for cases where three key sequences are retrieved. The users can restore the sequences to perform the decryption process according to private keys N and d.

Experimental Results
The numerical simulation and security verification of the algorithm are performed by Matlab R2017a. A standard grayscale image Lena of size 512 × 512 is shown in Figure 9a is the original image. The initial values and system parameters of the algorithm are m = 2, respectively. In addition, two prime numbers (p = 257 and q = 311) are applied in the RSA cryptosystem to obtain public key (N = 79, 927, e = 6937) and private key (d = 4393). Figure 9b shows the encrypted grayscale image Lena, and the decrypted image with correct keys is shown as Figure 9c.

Key Space Analysis
In this work, the precision of noninteger key is considered as 10 −16 . This algorithm covers a chaotic Hopfield neural network with 3 noninteger initial values, fuzzy single neuronal dynamic system with 7 noninteger initial values and other system parameters. Thus, the key space is larger than 2 128 , which is enough to resist brute force attacks [46,47].

Sensitivity Analysis
In order to test key sensitivity, the influence of varying initial values and system parameters on the decryption result is explored. When the initial deviation of the chaotic Hopfield neural network or fuzzy single neuronal dynamic system is 10 −16 , the generated sequence and random phase masks cannot correctly decrypt the image, as shown in Figure 10. In addition, the correlation coefficient (CC) is used as the criterion for quantitative analysis of the difference between the original image and decrypted image.
where f 1 (i, j) represents the plaintext image, f 2 (i, j) represents the recovered image, and E(·) represents the expected value operation.
The relationship between CC of the decrypted image and initial values is obtained, as shown in Figure 11. It can be seen that any information about the plaintext image cannot be retrieved when keys change slightly. Thus, the sensitivity of the algorithm is qualified. Figure 11. Sensitivity analysis of the keys of chaotic systems: (a) decrypted CC curve of the key u 0 ; (b) decrypted CC curve of the keys x 1 (1), x 2 (1) and x 3 (1).

Correlation Analysis
Due to the discernibility of information in plaintext images, adjacent pixels are usually highly correlated. Therefore, the reduction of the correlation between adjacent pixels of the cipher images is necessary [48]. The calculation of pixel correlation is shown as Equation (21).
where x i and y i represent the values of adjacent pixels, and ρ xy denotes the correlation between adjacent pixels. The results of correlation coefficients of plaintext images and cipher images in horizontal direction, vertical direction and diagonal direction are shown in Table 1.  [49] 0.9407 −0.0273 −0.0140 Cipher image [50] −0.0097 0.0032 −0.0051 Cipher image [51] −0.0084 −0.0017 −0.0019 Cipher image [52] −0.0023 0.0028 −0.0030  [49] 0.9323 −0.0482 −0.0306 Cipher image [50] −0.0155 −0.0251 0.0013 Cipher image [51] 0.0026 −0.0015 0.0014 Cipher image [52] −0.0060 −0.0064 −0.0050 It should be noted that the scheme combines double random phase encoding in 4f system and Fresnel domain with Hopfield neural network to address inherent limitation of random matrix construction. The correlation coefficients of four encrypted images using various schemes are also demonstrated in Table 1. It can be seen that our method reaches relatively low correlation coefficients compared with other methods, which indicates that the integration of double random phase encoding and Hopfield neural network can achieve better performance.

Histogram Analysis
Histogram analysis is the statistic of the number of times each value appears, in order to demonstrate the distribution of pixel values [26]. The histogram of cipher image should not reflect any information about the original image. Figure 12 shows the histogram analysis of four images. It can be seen that the histograms of encrypted test images approximate Rayleigh distribution function, therefore the frequency distribution of plaintext images is hidden.

Binary Image Test
Due to the simple content of binary images, the traditional methods are not applicable sometimes. To test the performance of the algorithm on binary images, the results of encryption are shown in Figure 13. It can be seen that our algorithm works well on binary images, and the correlation coefficients of cipher images are listed in Table 2.  In practice, the cipher images may be affected by noise. We consider the robustness of our algorithm against noise by polluting the encrypted images of Lena with Gaussian random noise, which is expressed as: where M(x, y) denotes the original cipher image, M (x, y) denotes the noise-affected cipher image, k is the noise strength and G(x, y) is the Gaussian random noise with zero-mean and variance 1. The decrypted images with the noise intensity k = 0.01, k = 0.05 and k = 0.1 are shown in Figure 14. The CC value changing with the noise strength is shown in Figure 15. It can be seen that the contour of original image can be distinguished from the decrypted image.

Comparative Analysis
The comparative analysis among different schemes is demonstrated in Table 3. The experimental environments are as follows: Matlab R2017a, AMD Ryzen 5 3600 6-Core Processor 3.60 GHz with 16 GB memory and Windows 10 Operation System, and grayscale Pepper is used as the plaintext image. Table 3 shows that our method reaches the lowest running time in the decryption process, and the running time is slightly higher than [50] in the encryption process. In addition, CC values between the original image and decrypted image are listed in Table 3. It can be seen that the scheme in this study achieves the highest CC value, which is related to the more accurate reconstruction of random phase mask by using the chaotic Hopfield neural network.

Conclusions
This paper proposes an optical image encryption method using double random-phase encoding in 4f system and Fresnel domain based on chaotic system. The chaotic sequences are constructed by applying a fuzzy single neuronal dynamic system and a Hopfield chaotic neural network. The plaintext image is decomposed into sub-signals by wavelet packet transform, and then the sub-signals are scrambled. By adaptive classification, the sub-signals are divided into two layers. The first layer and second layer are encrypted in 4f system and Fresnel domain, thus completing the hybrid encryption. After inverse wavelet packet transform, the encrypted image is obtained through another scrambling. The RSA cryptosystem is applied to the allocation and management of the keys used in the scheme. Numerical simulations have demonstrated the security and effectiveness of the proposed scheme. The suggested scheme implements selective encryption of the local image, which improves the protection efficiency of vital information. It should be noted that the fuzzy numbers effectively enhance the stability and key space of the single neuronal dynamic system, and different fuzzy numbers other than triangular may be applicable to more chaotic systems. In addition, the feasibility of combining the chaotic Hopfield neural network with optical methods to construct an image encryption scheme has been verified. In further work, the application of other neural networks or chaotic systems may have more positive effects on optical image encryption.