Color image encryption and decryption method based on logic discrete Hopfield neural network
The LDHNN-based method addresses convergence and efficiency issues in DHNN by managing neuron states with logical rules, achieving secure and efficient image encryption and decryption.
Patent Information
- Application Number
- CN202411267867.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-11
- Publication Date
- 2024-12-20
AI Technical Summary
Discrete Hopfield neural networks face convergence issues, leading to local optimal solutions and low computational efficiency when processing large-scale image data, limiting their effectiveness in image encryption and decryption.
A color image encryption and decryption method utilizing a logical discrete Hopfield neural network (LDHNN) with embedded 2-SAT logic rules and a learning mechanism to manage convergence direction, ensuring accurate decryption and improving efficiency by managing neuron states through logical rules.
The method achieves fast and stable convergence to global optimal solutions, enhancing processing efficiency and security, adapting to large-scale image data, and ensuring data integrity and confidentiality.
Smart Images

Figure CN119169112A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of image encryption and decryption, and in particular to a color image encryption and decryption method based on a logical discrete Hopfield neural network. Background Art
[0002] Discrete Hopfield neural network (DHNN) shows potential as an image encryption and decryption tool due to its pattern storage and recovery capabilities, noise resistance, parallel computing characteristics, and adaptability and self-organization. During the encryption phase, DHNN can adaptively form a specific network weight configuration to store the original image pattern; during the decryption phase, based on the principle of minimizing the energy function, the network gradually stabilizes to an attractor state, which can represent a local or global optimal solution, and ideally restore the original image.
[0003] However, DHNN needs to solve two major technical obstacles before it can become a mainstream image encryption and decryption technology:
[0004] The first is the convergence problem. In practical applications, DHNN is easily limited by the network capacity and dynamic properties, and often falls into the local optimal solution and cannot accurately converge to the global minimum. The global optimal solution is the correct representation of the original image, so this limitation may cause the decryption process to fail.
[0005] The second is low computational efficiency. When processing large-scale image data, DHNN, as a fully connected single-layer network, requires a lot of computing resources and time, which significantly reduces the efficiency of encryption and decryption. Summary of the invention
[0006] The present invention aims to at least solve the technical problems existing in the prior art. To this end, the present invention proposes a color image encryption and decryption method based on a logical discrete Hopfield neural network, which utilizes the fast convergence ability of the logical discrete Hopfield neural network (LDHNN) and effectively manages the convergence direction of neurons through logical rules, so as to realize accurate encryption and decryption of color images, which not only significantly improves the processing efficiency and adapts to the encryption and decryption requirements of large-scale image data, but also overcomes the convergence instability of the traditional DHNN model, improves the efficiency and security of encryption and decryption, improves the security and anti-attack capability of the system, and ensures the integrity and confidentiality of image data.
[0007] According to some embodiments of the present invention, a color image encryption and decryption method based on a logical discrete Hopfield neural network includes the following steps:
[0008] Step S100, preprocessing the input original image into a K×K binary reversible pixel matrix F;
[0009] Step S200, randomly generate a 2-SAT logic rule P containing K×K variables and having a unique global optimal solution X;
[0010] Step S300, calculating the weight matrix W of P according to the Wan Abdullah learning method, and generating a weight parameter key A;
[0011] Step S400, constructing a logical discrete Hopfield neural network with an embedded 2-SAT logic rule P according to the weight matrix W;
[0012] Step S500, calculating a conversion matrix T according to a unique global optimal solution X and a binary reversible pixel matrix F, and generating a conversion parameter key B;
[0013] Step S600, reconstructing the corresponding logical discrete Hopfield neural network according to the generated weight parameter key A;
[0014] Step S700, obtaining a unique global optimal solution X according to the reconstructed logical discrete Hopfield neural network;
[0015] Step S800: Obtain a binary reversible pixel matrix F of an image K×K according to the unique global optimal solution X and the conversion parameter key B, perform inverse preprocessing, and convert it into an image for output.
[0016] A color image encryption and decryption method based on a logical discrete Hopfield neural network according to some embodiments of the present invention has at least the following beneficial effects:
[0017] The present invention proposes a color image encryption and decryption method based on a logical discrete Hopfield neural network. The method utilizes the fast convergence ability of a logical discrete Hopfield neural network (LDHNN) and effectively manages the convergence direction of neurons through logical rules, thereby realizing accurate encryption and decryption of color images, overcoming the convergence instability of a traditional DHNN model, significantly improving processing efficiency, and adapting to the encryption and decryption needs of large-scale image data. The method also adopts a logical discrete Hopfield neural network as the core framework for encryption and decryption, abandoning the classic Fridrich scrambling-diffusion structure, and improving the efficiency and security of encryption and decryption through the network's own learning-recovery mechanism, thereby improving the security and anti-attack capability of the system and ensuring the integrity and confidentiality of image data.
[0018] According to some embodiments of the present invention, a color image encryption and decryption method based on a logical discrete Hopfield neural network, the step S100 specifically includes: processing the original color image of size M×N according to three channels of red, green and blue, and the pixel value of each channel is converted into an 8-bit binary number, and further converted into a binary pixel matrix of 1×M×N×8×3; then, by adding additional rows or columns at the matrix boundary, the 1×M×N×8×3 binary pixel matrix is expanded to a K×K reversible pixel matrix F.
[0019] According to some embodiments of the present invention, a color image encryption and decryption method based on a logical discrete Hopfield neural network, the weight matrix calculated according to the Wan Abdullah learning method specifically includes: constructing The cost function E and the Lyapunov energy function H P , through the The cost function E and the Lyapunov energy function H P To obtain the weight matrix W of P.
[0020] According to some embodiments of the present invention, a color image encryption and decryption method based on a logical discrete Hopfield neural network is constructed. The cost function E specifically includes: and denote neurons X and The logical value of S. If X is true, then S X The value of is 1. If X is false, then S X The value of is -1; use multiplication to represent conjunctive connectives, and addition to represent disjunctive connectives;
[0021] The Lyapunov energy function H P for:
[0022]
[0023] According to some embodiments of the present invention, a color image encryption and decryption method based on a logical discrete Hopfield neural network further includes step S310 between step S300 and step S400: according to the unique global optimal solution X of P, calculating the Lyapunov ideal minimum energy H of P min ;
[0024] According to some embodiments of the present invention, a color image encryption and decryption method based on a logical discrete Hopfield neural network, the step S400 specifically includes: setting the K×K neurons of the network to correspond one-to-one with the K×K logical variables of the 2-SAT logic rule P, and the w in W i For neuron xi Its own weight, w ij For a neuron pair (x i , x j ) between them.
[0025] According to a color image encryption and decryption method based on a logical discrete Hopfield neural network in some embodiments of the present invention, the step S500 specifically includes: calculating the conversion matrix T = F -1 X, and stored as the conversion parameter key B;
[0026] According to some embodiments of the present invention, a color image encryption and decryption method based on a logical discrete Hopfield neural network includes step S710 between step S700 and step S800: randomly initializing the state of each neuron of the network to 1 or 0;
[0027] The step S710 and the step S800 include a step S720: calculating each neuron x i The local field h i ,h i (t) = ∑ j W ij S j (t)-W i ; Each neuron x i According to the McCulloch-Pitts update rule, the neural network is updated until it reaches a stable state. The activation function is usually a symbolic function. The neuron x i The new state S at time t+1 i (t+1) is:
[0028]
[0029] According to some embodiments of the present invention, a color image encryption and decryption method based on a logical discrete Hopfield neural network includes step S730 between step S720 and step S800: determining the minimum energy formula |H P -H min |<0.001, to determine whether this stable state is the global optimal solution of P. If it satisfies the minimum energy judgment formula, it means that the stable state is the global optimal solution X. Otherwise, the stable state is a local optimal solution.
[0030] According to a color image encryption and decryption method based on a logical discrete Hopfield neural network in some embodiments of the present invention, step S800 specifically includes: calculating a pixel matrix F according to a conversion parameter key B and a global optimal solution X:
[0031] F=X·T -1;
[0032] The K×K reversible pixel matrix F is restored to a 1×M×N×8×3 binary pixel matrix by deleting extra rows or columns at the boundaries of the matrix, and then the pixel values of each channel are restored according to the three primary color channels and converted into an image for output.
[0033] Additional aspects and advantages of the present invention will be given in part in the following description and in part will be obvious from the following description, or will be learned through practice of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS
[0034] The above and / or additional aspects and advantages of the present invention will become apparent and easily understood from the description of the embodiments in conjunction with the following drawings, in which:
[0035] Figure 1 is a flow chart of an embodiment of the present invention.
[0036] Figure 2 This is a comparison chart of image encryption and decryption results according to an embodiment of the present invention.
[0037] Figure 3 This is a comparison chart of key sensitivity analysis results of an embodiment of the present invention. DETAILED DESCRIPTION
[0038] Embodiments of the present invention are described in detail below, and examples of the embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present invention, and cannot be understood as limiting the present invention.
[0039] In the description of the present invention, it should be understood that the descriptions involving orientations, such as up, down, left, right, front, back, etc., and the orientations or positional relationships indicated are based on the orientations or positional relationships shown in the accompanying drawings, and are only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the modules or elements referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore should not be understood as a limitation on the present invention.
[0040] In the description of the present invention, if there is a description of first and second, it is only for the purpose of distinguishing the technical features, and cannot be understood as indicating or implying the relative importance or implicitly indicating the number of the indicated technical features or implicitly indicating the order of the indicated technical features.
[0041] In the description of the present invention, unless otherwise clearly defined, terms such as setting, installing, connecting, etc. should be understood in a broad sense, and technicians in the relevant technical field can reasonably determine the specific meanings of the above terms in the present invention based on the specific content of the technical solution.
[0042] Logical discrete Hopfield neural network (LDHNN), also known as DHNN-SAT model, is a variant of discrete Hopfield neural network. By embedding specific logical rules in the traditional DHNN architecture, the network is endowed with the ability to solve the Boolean satisfiability problem (SAT). Compared with traditional DHNN, LDHNN not only inherits the parallel computing advantages of DHNN, but also significantly improves the stability and convergence speed of the network. According to the research in reference 1 (Feng, C., Sathasivam, S., Roslan, N. and Velavan, M. 2-SAT discrete Hopfield neural networks optimization via Crow search and fuzzy dynamical clustering approach. AIMS Mathematics. 2024. 9 (4), pp. 9232-9266.), it is found that the logical rules and logical complexity of LDHNN affect the number of optimal solutions. Under certain specific logical rules and complexity conditions, LDHNN can converge to the only global optimal solution.
[0043] like Figure 1-Figure 3 As shown, an embodiment of the present invention provides a color image encryption and decryption method based on a logical discrete Hopfield neural network.
[0044] A color image encryption and decryption method based on a logical discrete Hopfield neural network comprises the following steps:
[0045] Step S100, preprocessing the input original image into a K×K binary reversible pixel matrix F;
[0046] Step S200, randomly generate a 2-SAT logic rule P containing K×K variables and having a unique global optimal solution X;
[0047] Step S300, calculating the weight matrix W of P according to the Wan Abdullah learning method, and generating a weight parameter key A;
[0048] Step S400, constructing a logical discrete Hopfield neural network with an embedded 2-SAT logic rule P according to the weight matrix W;
[0049] Step S500, calculating a conversion matrix T according to a unique global optimal solution X and a binary reversible pixel matrix F, and generating a conversion parameter key B;
[0050] Step S600, reconstructing the corresponding logical discrete Hopfield neural network according to the generated weight parameter key A;
[0051] Step S700, obtaining a unique global optimal solution X according to the reconstructed logical discrete Hopfield neural network;
[0052] Step S800: Obtain a binary reversible pixel matrix of image K×K according to the unique global optimal solution X and the conversion parameter key B, perform inverse preprocessing, and convert it into an image for output.
[0053] It can be understood that step S100, step S200, step S300, step S400, and step S500 are encryption steps, and step S600, step S700, and step S800 are decryption steps.
[0054] The present invention proposes a color image encryption and decryption method based on a logical discrete Hopfield neural network. The method utilizes the fast convergence ability of a logical discrete Hopfield neural network (LDHNN) and effectively manages the convergence direction of neurons through logical rules, thereby realizing accurate encryption and decryption of color images, overcoming the convergence instability of a traditional DHNN model, significantly improving processing efficiency, and adapting to the encryption and decryption needs of large-scale image data. The method also adopts a logical discrete Hopfield neural network as the core framework for encryption and decryption, abandoning the classic Fridrich scrambling-diffusion structure, and improving the efficiency and security of encryption and decryption through the network's own learning-recovery mechanism, thereby improving the security and anti-attack capability of the system and ensuring the integrity and confidentiality of image data.
[0055] In the color image encryption and decryption method based on the logical discrete Hopfield neural network described in this example, the step S100 specifically includes: processing the original color image of size M×N according to the three channels of red, green and blue, and the pixel value of each channel is converted into an 8-bit binary number, and further converted into a binary pixel matrix of 1×M×N×8×3. Subsequently, the binary pixel matrix of 1×M×N×8×3 is expanded to a reversible pixel matrix F of K×K by adding additional rows or columns at the matrix boundary.
[0056] Specifically, first, the original color image is decomposed into three color channels: red, green, and blue, to obtain three grayscale images. The pixel value of each channel ranges from 0 to 255, representing the color intensity of the channel. Next, the pixel values of each channel are converted into 8-bit binary numbers in turn. Then, the binary pixel values of the three channels are integrated into a binary pixel matrix of size 1×M×N×8×3. In this matrix, M and N represent the width and height of the image, 3 represents the three RGB channels of the image, and 8 represents the number of bits of each pixel in binary representation. Finally, in order to obtain a K×K reversible pixel matrix F, the previously obtained 1×M×N×8×3 binary matrix needs to be expanded. The expansion method is to add additional rows or columns at the boundaries of the matrix so that the final dimension of the matrix reaches K×K, where K is a value greater than or equal to max(M×3×8, N). This expansion step ensures that the dimension of the matrix is suitable for subsequent image encryption and decryption processing, and is reversible, which facilitates the restoration of the original data during the decryption process.
[0057] In the color image encryption and decryption method based on the logic discrete Hopfield neural network described in this example, the step S200 specifically includes: randomly generating a 2-SAT logic rule P containing K×K variables and having a unique global optimal solution X. The 2-SAT logic rule P is a conjunction normal form, each logic clause is composed of 2 logic variables according to a specific logic rule, and there are many ways to form the logic rule. For example, a conjunction normal form containing 2 logic variables and 4 logic clauses: The conjunction normal form P composed of such logical rules has a unique global optimal solution X = {L 1 =1,L 2 =-1}.
[0058] The color image encryption and decryption method based on the logical discrete Hopfield neural network described in this example specifically includes: constructing a weight matrix calculated according to the Wan Abdullah learning method. The cost function E and the Lyapunov energy function H P , through the The cost function E and the Lyapunov energy function H P To obtain the weight matrix W of P. The weights in W are symmetric, with w ij =w ji , and w ii =0.
[0059] This example describes a color image encryption and decryption method based on a logical discrete Hopfield neural network. The cost function E specifically includes: and denote neurons X and The logical value of S. If X is true, then S X The value of is 1. If X is false, then S X The value of is -1; conjunctive connectives are represented by multiplication, while disjunctive connectives are represented by addition.
[0060] This example describes a color image encryption and decryption method based on a logical discrete Hopfield neural network. The Lyapunov energy function H P for:
[0061]
[0062] The color image encryption and decryption method based on the logical discrete Hopfield neural network described in this example further includes step S310 between step S300 and step S400: according to the unique global optimal solution X of P, calculate the Lyapunov ideal minimum energy H of P min ;
[0063] In the color image encryption and decryption method based on the logic discrete Hopfield neural network described in this example, the step S400 specifically includes: setting K×K neurons in the network to correspond one-to-one with the K×K logical variables in the 2-SAT logic rule P. In the weight matrix W of the neural network, w i For neuron x i The self-feedback weight, w ij For a neuron pair (x i , x j ) is the connection weight between them.
[0064] Specifically, first, according to the 2-SAT logic rule P, define the K×K neurons of the neural network and establish a one-to-one correspondence with the K×K logical variables in P. This step ensures that the state of each neuron can represent the true or false value of the logical variable, that is, the state of each neuron is 0 or 1, corresponding to the false or true value of the logical variable, respectively. Finally, define w in the weight matrix W i For neuron x i The self-feedback weight, w ij For a neuron pair (x i , x j ) is the connection weight between them.
[0065] In this example, a color image encryption and decryption method based on a logical discrete Hopfield neural network is described. Step S500 specifically includes: calculating the transformation matrix T = F -1 X, and stored as the conversion parameter key B.
[0066] Specifically, first, calculate the transformation matrix T = F -1 X, through this matrix operation, the original image data F is converted into new encrypted data T. This conversion matrix T contains the core information of the encrypted image. Then, the matrix T is stored as the conversion parameter key B.
[0067] The color image encryption and decryption method based on a logical discrete Hopfield neural network described in this example includes step S710 between step S700 and step S800: randomly initializing the state of each neuron of the network to 1 or 0.
[0068] The color image encryption and decryption method based on the logical discrete Hopfield neural network described in this example includes step S720 between step S710 and step S800: calculating each neuron x i The local field h i ,h i (t)=∑ j W ij S j (t)-W i ; Each neuron x i According to the McCulloch-Pitts update rule, the neural network is updated until it reaches a stable state. The activation function is usually a symbolic function. The neuron x i The new state S at time t+1 i (t+1) is:
[0069]
[0070] Specifically, calculate each neuron x i The local field h i ,h i (t)=∑ j W ij S j (t)-W i Among them, W ij It is neuron x i and x j The weight between them, Sj(t) is the weight of neuron x j At the state at time t, W i It is neuron x i Then, each neuron x i According to the McCulloch-Pitts update rule, the activation function is usually a symbolic function, and the neuron x i The new state S at time t+1 i The calculation formula for (t+1) is:
[0071]
[0072] Each neuron in the network continuously updates its state according to the above formula. As the network continues to iterate, under the minimum energy excitation, the network will gradually converge to a stable state. In this process, the network energy continues to decrease until it reaches a local or global minimum. The condition for the network to stop updating is when each neuron x i The state of satisfies the following steady-state judgment condition, that is, when it remains unchanged for five consecutive time steps, the network is considered to have reached a stable state. The specific formula is as follows:
[0073] S i (t+1)=S i (t+2)=S i (t+3)=S i (t+4)=S i (t+5)
[0074] When all neurons meet this condition, the network stops updating, indicating that the neural network has entered a stable state.
[0075] The color image encryption and decryption method based on the logical discrete Hopfield neural network described in this example includes step S730 between step S720 and step S800: determining the minimum energy formula |H P -H min |<0.001, to determine whether this stable state is the global optimal solution of P. If it satisfies the minimum energy judgment formula, it means that the stable state is the global optimal solution X. Otherwise, the stable state is a local optimal solution.
[0076] The basic example is a color image encryption and decryption method based on a logical discrete Hopfield neural network, wherein step S800 includes step S810: calculating a pixel matrix F according to a conversion parameter key B and a global optimal solution X:
[0077] F=X·T -1 .
[0078] This example describes a color image encryption and decryption method based on a logical discrete Hopfield neural network, wherein step S800 includes step S820: restoring the K×K reversible pixel matrix F into a 1×M×N×8×3 binary pixel matrix F by deleting extra rows or columns at the boundary of the matrix, and then restoring the pixel values of each channel according to the three primary color channels and converting them into an image for output.
[0079] According to the color image encryption and decryption method based on logical discrete Hopfield neural network described in this example, its quality and security are evaluated as follows:
[0080] 1. Select a standardized image database: Select 512×512 color images from the standardized image database USC-SIPI (https: / / sipi.usc.edu / database / ) as the test data set.
[0081] 2. Image encryption and decryption test: Encryption and decryption tests were performed on the images in each image database. Each experiment was repeated 100 times. The experimental results are summarized in the following table:
[0082]
[0083] The results of image encryption and decryption in this example are as follows Figure 2 shown.
[0084] 3. Evaluate image quality fidelity: Use peak signal-to-noise ratio (PSNR) and structural similarity index (SSIM) to evaluate image quality fidelity, and calculate them for the red, green, and blue channels respectively.
[0085]
[0086]
[0087] Where MAX is the maximum pixel value of the image, usually 255, and MSE is the mean square error, which calculates the average of the square errors of the corresponding pixels of the decrypted image and the original image;
[0088]
[0089] Where x and y represent two images of the original image and the decrypted image in the same color channel. x ,μ y is the average brightness of the x,y image. is the variance of the x,y image. xy is the covariance of the x,y images. 1 =(k 1 L) 2 ,c 2 =(k 2 L) 2 is a constant used to maintain stability, L is the dynamic range of pixel values (for 8-bit images, L = 255), k 1 = 0.01 and k 2 =0.03 is the default value.
[0090] The experimental results are shown in the following table:
[0091]
[0092]
[0093] From the above table, we can conclude that PSNR is infinite, SSIM is 1, and MSE is zero, all of which reach the theoretical optimal values, ensuring lossless restoration of image quality; the mean square error (MSE) is zero, indicating that the decrypted image is completely consistent with the original image at the pixel level.
[0094] At the same time, the intelligent color image encryption and decryption technology based on the logical discrete Hopfield neural network in this example only transmits the key, and does not need to transmit the ciphertext. Therefore, this technology can resist the commonly used attacks and inspection methods involving ciphertext, such as ciphertext attack, image histogram analysis, correlation analysis of adjacent pixels, information entropy analysis, differential attack analysis, etc.
[0095] It is understandable that key sensitivity analysis aims to determine the sensitivity of the encryption process to small changes in the key. Due to the nonlinear characteristics of the neural network, this example has extremely high requirements for the weight matrix. Even if the parameter key and the transformation parameter key change slightly, the original dynamic logic discrete Hopfield neural network cannot be accurately restored. This will cause the network to fail to converge to the minimum energy state and thus fail to successfully decrypt. The results of the key sensitivity analysis of this example are shown in Figure 1. Figure 3 shown.
[0096] Although the embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit of the present invention, and that the scope of the present invention is defined by the claims and their equivalents.
Claims
1. A color image encryption and decryption method based on a logical discrete Hopfield neural network, characterized in that: The following steps are involved: Step S100, preprocessing the input original image into a K×K binary reversible pixel matrix F; Step S200, randomly generate a 2-SAT logic rule P containing K×K variables and having a unique global optimal solution X; Step S300, calculating the weight matrix W of P according to the Wan Abdullah learning method, and generating a weight parameter key A; Step S400, constructing a logical discrete Hopfield neural network with an embedded 2-SAT logic rule P according to the weight matrix W; Step S500, calculating a conversion matrix T according to a unique global optimal solution X and a binary reversible pixel matrix F, and generating a conversion parameter key B; Step S600, reconstructing the corresponding logical discrete Hopfield neural network according to the generated weight parameter key A; Step S700, obtaining a unique global optimal solution X according to the reconstructed logical discrete Hopfield neural network; Step S800: Obtain a binary reversible pixel matrix F of an image K×K according to the unique global optimal solution X and the conversion parameter key B, perform inverse preprocessing, and convert it into an image for output.
2. The color image encryption and decryption method based on the logical discrete Hopfield neural network according to claim 1 is characterized in that: The step S100 specifically includes: processing the original color image of size M×N according to the three channels of red, green and blue, converting the pixel value of each channel into an 8-bit binary number, and further converting it into a binary pixel matrix of 1×M×N×8×3; then, by adding additional rows or columns at the matrix boundary, the 1×M×N×8×3 binary pixel matrix is expanded to a K×K reversible pixel matrix F.
3. The color image encryption and decryption method based on logical discrete Hopfield neural network according to claim 1 is characterized in that: The weight matrix calculated according to the Wan Abdullah learning method specifically includes: constructing The cost function E and the Lyapunov energy function H P , through the The cost function E and the Lyapunov energy function H P To obtain the weight matrix W of P.
4. The color image encryption and decryption method based on logical discrete Hopfield neural network according to claim 3 is characterized in that: The structure The cost function E specifically includes: and represent neurons X and The logical value of S. If X is true, then S X The value of is 1. If X is false, then S X The value of is -1; use multiplication to represent conjunctive connectives, and addition to represent disjunctive connectives; The Lyapunov energy function H P for:
5. The color image encryption and decryption method based on logical discrete Hopfield neural network according to claim 1 is characterized in that: Between step S300 and step S400, step S310 is also included: according to the only global optimal solution X of P, the Lyapunov ideal minimum energy H of P is calculated. min .
6. The color image encryption and decryption method based on logical discrete Hopfield neural network according to claim 1 is characterized in that: The step S400 specifically includes: setting the K×K neurons of the network to correspond one-to-one with the K×K logical variables of the 2-SAT logic rule P, and the w in W i For neuron x i Its own weight, w ij For a neuron pair (x i , x j ) between them.
7. The color image encryption and decryption method based on logical discrete Hopfield neural network according to claim 1 is characterized in that: The step S500 specifically includes: calculating the conversion matrix T=F -1 X, and stored as the conversion parameter key B. ; 8. The color image encryption and decryption method based on logical discrete Hopfield neural network according to claim 1 is characterized in that: The method includes step S710 between step S700 and step S800: randomly initializing the state of each neuron of the network to 1 or 0; The step S710 and the step S800 include a step S720: calculating each neuron x i The local field h i ,h i (t) = ∑ j W ij S j (t)-W i ; Each neuron x i According to the McCulloch-Pitts update rule, the neural network is updated until it reaches a stable state. The activation function is usually a symbolic function. The neuron x i The new state S at time t+1 i (t+1) is:
9. The color image encryption and decryption method based on logical discrete Hopfield neural network according to claim 8, characterized in that: Step S730 is included between step S720 and step S800: determining the minimum energy by formula |H P -H min |<0.001, to determine whether this stable state is the global optimal solution of P. If it satisfies the minimum energy judgment formula, it means that the stable state is the global optimal solution X. Otherwise, the stable state is a local optimal solution.
10. The color image encryption and decryption method based on logical discrete Hopfield neural network according to claim 1, characterized in that: The step S800 specifically includes: calculating the pixel matrix F according to the conversion parameter key B and the global optimal solution X: F=X·T -1 ; The K×K reversible pixel matrix F is restored to a 1×M×N×8×3 binary pixel matrix by deleting extra rows or columns at the boundaries of the matrix, and then the pixel values of each channel are restored according to the three primary color channels and converted into an image for output.
