Multistable Memristor Synapse-Based Coupled Bi-Hopfield Neuron Model: Dynamic Analysis, Microcontroller Implementation and Image Encryption

: The memristor, a revolutionary electronic component, mimics both neural synapses and electromagnetic induction phenomena. Recent study challenges are the development of effective neural models and discovering their dynamics. In this study, we propose a novel Hopfield neural network model leveraging multistable memristors, showcasing its efficacy in encoding biomedical images. We investigate the equilibrium states and dynamic behaviors of our designed model through comprehensive numerical simulations, revealing a rich array of phenomena including periodic orbits, chaotic dynamics, and homogeneous coexisting attractors. The practical realization of our model is achieved using a microcontroller, with experimental results demonstrating strong agreement with theoretical analyses. Furthermore, harnessing the chaos inherent in the neural network, we develop a robust biomedical image encryption technique, validated through rigorous computational performance tests.


Introduction
Hopfield networks have emerged as pivotal models in the field of neuroscience owing to their dynamic behavior and efficient structure [1].These networks provide a valuable framework for exploring human memory mechanisms, with both continuous and discrete models being extensively studied [2][3][4].Their practicality lies in their ability to capture associative memory processes, making them indispensable tools for investigating cognition and learning [5][6][7][8].
Recent research has exposed an overabundance of intriguing dynamics within memristorbased Hopfield networks.Notably, Sun et al. introduced the concept of boosting dynamics, amplifying the network's computational capabilities [9].Investigations into multistability have shed light on the diverse states these networks can exhibit, offering potential avenues for information storage and retrieval [8,10].Furthermore, the exploration of chaos and multiple scrolls in memristor-cascaded Hopfield networks underscores their rich dynamical repertoire [11][12][13].Symmetric behaviors observed in bi-neuron Hopfield networks hint at their robustness and potential for pattern recognition tasks [14].Synapse-coupled architectures have revealed intriguing phenomena such as initial sensitivity, further enhancing our understanding of network dynamics [15].Additionally, the incorporation of hidden neurons has bolstered the recognition abilities of Hopfield models, paving the way for more sophisticated cognitive architectures capable of long-term memory storage [16][17][18][19].
The attraction of Hopfield networks lies not only in their theoretical elegance but also in their myriad practical applications.Image encryption utilizing Hopfield networks has garnered considerable attention due to its promise of robust security and efficient encoding schemes [20][21][22][23].Beyond encryption, these networks have found utility in various artificial intelligence applications, harnessing their associative memory properties for tasks such as pattern recognition and optimization [24].Implementation-wise, the realization of both continuous and discrete Hopfield networks has been achieved using diverse hardware platforms, ranging from STM32 microcontrollers to DSPs and analog circuits [25,26].In other papers, authors focus on optimizing the realization of Hopfield networks through both analog and digital circuit implementations, aiming to harness the full potential of these networks in practical applications [27][28][29][30].
This paper introduces a novel approach to a coupled bi-Hopfield network, unraveling its dynamics and laying the groundwork for its practical deployment.By delving into the intricacies of network realization and dynamics, we aim to facilitate its application.A comparison of this work related to published ones is made in Table 1.

System Description and Mathematical Model
In this work, we consider a multi-state flux-controlled memristor described as where W(z) is the memductance.In order to characterize the elaborated memristor described above, we apply an external force v M = A sin(2π f t) into the memristor.The I-V characteristics of the considered memristor are presented in Figure 1.All system parameter values are given in the figure caption.From Figure 1c, we can remark that the hysteresis loop areas retain the same shapes and the characteristic has different states depending on the initial conditions.Thus, the considered memristor is multistable.
We use the multi-state flux-controlled memristor described above to couple two neurons, as shown in Figure 2.
In Figure 2, an electromagnetic induction current, created by the difference in membrane potential between the two neurons, flows between the two neurons.This electromagnetic induction current influences the two neurons, and the state equations can be expressed as follows The parameters T 11 , T 12 , T 21 , and T 22 represent the synaptic connection weights considering constant.ρ represents the memristor coupling strength parameter, f (x) and f (y) are applied to activate the neurons and expressed as By taking a synaptic weight matrix as follows We obtain the multistable memristor synapse-based coupled bi-Hopfield neuron model as (5) In system (5), the auto-connection weights for the two Hopfield neurons are set to zero in order to simplify the final model.We use the multi-state flux-controlled memristor described above to couple two neurons, as shown in Figure 2. In Figure 2, an electromagnetic induction current, created by the difference in membrane potential between the two neurons, flows between the two neurons.This electromagnetic induction current influences the two neurons, and the state equations can be expressed as follows ( ) ( ) 11 12 We use the multi-state flux-controlled memristor described above to couple two neu rons, as shown in Figure 2. In Figure 2, an electromagnetic induction current, created by the difference in mem brane potential between the two neurons, flows between the two neurons.This electro magnetic induction current influences the two neurons, and the state equations can b expressed as follows ( ) ( ) The parameters 11 T , 12 T , 21 T , and 22 T represent the synaptic connection weight considering constant.ρ represents the memristor coupling strength parameter, ( )

Equilibrium Analysis
The equilibrium can be expressed as P = (x 0 , y 0 , z 0 ) (6) in which z 0 = sin −1 (y 0 − x 0 ), x 0 and y 0 are solved using the following equations where f (x 0 ) and f (y 0 ) are the functions used to activate the neurons.The Jacobin matrix can be calculated at P as According to Equation (7), the features of the equilibrium states P are studied based on the system parameters γ and ρ.The two functions H 1 (x 0 , y 0 ) and H 2 (x 0 , y 0 ) given in Equation ( 7) with the parameters (γ, ρ) = (0.7, 1) are plotted in Figure 3.The values of x 0 and y 0 are determined at the intersections of the two function curves.

Equilibrium Analysis
The equilibrium can be expressed as ( ) , , P x y z = (6) in which ( ) , 0 x and 0 y are solved using the following equations where ( ) The Jacobin matrix can be calculated at P as   From Figure 3, system (5) has three equilibrium states for (γ, ρ) = (0.7, 1).The analysis of these equilibrium states is presented in Table 2. From the results in Table 2, we can conclude that the equilibrium points are unstable saddle points for the considered values of the system parameters γ and ρ.

Numerical Study
Bifurcation diagrams associated with corresponding Lyapunov exponents as a function of system parameters, as well as initial states, phase portraits, and basin of attraction, are computed to illustrate the complicated behaviors of the model under consideration.
From the results in Table 2, we can conclude that the equilibrium points are unstable saddle points for the considered values of the system parameters γ and ρ .

Numerical Study
Bifurcation diagrams associated with corresponding Lyapunov exponents as a function of system parameters, as well as initial states, phase portraits, and basin of attraction, are computed to illustrate the complicated behaviors of the model under consideration.Figure 4 reveals that chaos occurs in the considered model through period-doubling bifurcation.We can identify some windows indicating periodic oscillations intercalated by chaos.The route to chaos is confirmed by plotting phase spaces presented in Figure 5, for γ = 0.7 and diverse selected values of ρ.
It is very clear from Figure 5 that the system in the study displays complex and abundant patterns.
The impact of the initial state z(0) associated with the memristor on the comportments of the model is shown in Figure 6, for γ = 0.7 and ρ = 1.97.
The initial state z(0) considerably impacts the dynamic behavior of the considered model (see Figure 6).
Phase portraits and basin of attraction are shown in Figures 7 and 8 in order to support the result carried out in Figure 6, for γ = 0.7 and ρ = 1.97.The initial state ( ) 0 z considerably impacts the dynamic behavior of the considered model (see Figure 6).
Phase portraits and basin of attraction are shown in Figures 7 and 8 in order to support the result carried out in Figure 6, for 0.7 γ = and 1.97 ρ = .

Experimental Study
We carried out here a microcontroller implementation of the system.Implementing chaotic systems using microcontrollers has many advantages over using electronic components.These advantages include high computing performances, excellent precision, flexibility and stability, and the facility to manage the system parameters conveniently [25][26][27][28][29].In this work, we use an Arduino Due microcontroller card, which is constructed with an Atmel SAM3X8E ARM Cortex-M3 processor having a clock frequency of 84 MHz.Compared with other boards, this card has the advantage of incorporating two digital-toanalog converters, which makes it easy to implement chaotic systems.The main steps, which describe the implementation procedure of the elaborated multistable memristor synapse-based coupled bi-Hopfield neuron model, are shown in Figure 9.

Experimental Study
We carried out here a microcontroller implementation of the system.Implementing chaotic systems using microcontrollers has many advantages over using electronic components.These advantages include high computing performances, excellent precision, flexibility and stability, and the facility to manage the system parameters conveniently [25][26][27][28][29].In this work, we use an Arduino Due microcontroller card, which is constructed with an Atmel SAM3X8E ARM Cortex-M3 processor having a clock frequency of 84 MHz.Compared with other boards, this card has the advantage of incorporating two digital-to-analog converters, which makes it easy to implement chaotic systems.The main steps, which describe the implementation procedure of the elaborated multistable memristor synapse-based coupled bi-Hopfield neuron model, are shown in Figure 9.
The microcontroller implements the discrete form of system (5) using the Runge-Kutta algorithm with a fixed iteration step size of 0.01.The model parameters and initial conditions are chosen as they have identical values to those used in the numerical simulations.The hardware implementation devices are shown in Figure 10.[25][26][27][28][29].In this work, we use an Arduino Due microcontroller card, which is constructed with an Atmel SAM3X8E ARM Cortex-M3 processor having a clock frequency of 84 MHz.Compared with other boards, this card has the advantage of incorporating two digital-toanalog converters, which makes it easy to implement chaotic systems.The main steps, which describe the implementation procedure of the elaborated multistable memristor synapse-based coupled bi-Hopfield neuron model, are shown in Figure 9.The microcontroller implements the discrete form of system (5) using the Runge-Kutta algorithm with a fixed iteration step size of 0.01.The model parameters and initial    The results carried out from the microcontroller implementation (see Figure 11) are very similar to those obtained from numerical simulations (see Figure 5).This confirms that the Arduino Due microcontroller card is able to investigate the complete dynamics of the designed multistable memristor synapse-based coupled bi-Hopfield neuron model.

Application of the Designed Model for Biomedical Encryption Image
We exploit here the abundant dynamics of the elaborated model for image encryption.

Designing of Encryption Algorithm
Figure 12 presents the encryption algorithm.
There are five steps in the algorithm: (1) Integrate the chaotic system and carry out the public key K P (i); (2) Generate and test the random bits to construct the key K S (i); (3) In the layer of permutation, build the permuted image P(i) with the initial image and the public key K P (i); (4) Introduce the permuted image into the layer of confusion, which works with the S-box function to construct the confused image C(i); (5) Using a substitution operation (XOR), combine the image resulting from the confusion layer C(i) with the key K S (i) to obtain the masked image.
that the Arduino Due microcontroller card is able to investigate the complete dynamics of the designed multistable memristor synapse-based coupled bi-Hopfield neuron model

Application of the Designed Model for Biomedical Encryption Image
We exploit here the abundant dynamics of the elaborated model for image encryption.There are five steps in the algorithm:

Designing of Encryption Algorithm
(1) Integrate the chaotic system and carry out the public key ( ) (2) Generate and test the random bits to construct the key ( ) S K i ; For the decryption process, we apply the reverse of all operations realized during the encryption procedure.
The NIST test results are shown in Table 3.

Numerical Results
The numerical results are carried out in MATLAB16b environment.We use biomedical images of size 256 × 256 for cerebrovascular accident, pulmonary fibrosis, and lung cancer.Applying the encryption and decryption algorithm described below, the results for encrypted and decrypted biomedical images are shown in Figure 13.

Numerical Results
The numerical results are carried out in MATLAB16b environment.We use biomedical images of size 256 × 256 for cerebrovascular accident, pulmonary fibrosis, and lung cancer.Applying the encryption and decryption algorithm described below, the results for encrypted and decrypted biomedical images are shown in Figure 13.We can see that the unencrypted biomedical images (see Figure 13a-c) are very different from those obtained after the decryption process (see Figure 13d-f).Thus, the algorithm is efficient.

Analysis of Key Space and Key Sensibility
To withstand exhaustive attacks, the key space of the cryptosystem must exceed 100 2 [31].Our elaborated multistable memristor synapse-based coupled bi-Hopfield neuron model involves two constant system parameters and three initial states.For a precision of , which exceeds the required value.This confirms that the developed algorithm will be able to withstand exhaustive attacks.
The key sensitivity is analyzed by introducing a small perturbation of 17  10 to all pa- rameters of the system before the decryption of the sending image (cerebrovascular accident), as reported in Figure 14.We can see that the unencrypted biomedical images (see Figure 13a-c) are very different from those obtained after the decryption process (see Figure 13d-f).Thus, the algorithm is efficient.

Analysis of Performances of the Elaborated Biomedical Image Encryption Method 6.3.1. Analysis of Key Space and Key Sensibility
To withstand exhaustive attacks, the key space of the cryptosystem must exceed 2 100 [31].Our elaborated multistable memristor synapse-based coupled bi-Hopfield neuron model involves two constant system parameters and three initial states.For a precision of 10 17 , the key space is 10 17×3 = 10 85 , which exceeds the required value.This confirms that the developed algorithm will be able to withstand exhaustive attacks.
The key sensitivity is analyzed by introducing a small perturbation of 10 17 to all parameters of the system before the decryption of the sending image (cerebrovascular accident), as reported in Figure 14.
model involves two constant system parameters and three initial states.For a precision of , which exceeds the required value.This confirms that the developed algorithm will be able to withstand exhaustive attacks.
The key sensitivity is analyzed by introducing a small perturbation of 17  10 to all pa- rameters of the system before the decryption of the sending image (cerebrovascular accident), as reported in Figure 14.Looking at Figure 14, the key changes 17  10 , generating a high impact on the de- crypted image.The initial image can no longer be received after a small key modification.We can conclude that this algorithm is very sensitive to secret keys.

Information Entropy
The entropy is examined using its expression [32] ( ) 2 0 ( )log ( ) in which N and ( ) refer to the total number and frequency of occurrences of symbol i m , respectively.
The entropy is reported in Table 4, and its value for encrypted images approaches the standard value 8, which means that the encrypted image is more random.This confirms the good performance of the scheme.The correlation coefficient (CC) is calculated using its expression [33] ( in which x and y are the pixel values.The CC is reported in Table 5.Looking at the values in Table 5, we can remark that the values of correlation coefficient in horizontal, vertical, and diagonal directions of the image approach the standard values (i.e., CC is 1 for initial biomedical images and 0 for their encrypted versions).This Looking at Figure 14, the key changes 10 17 , generating a high impact on the decrypted image.The initial image can no longer be received after a small key modification.We can conclude that this algorithm is very sensitive to secret keys.

Information Entropy
The entropy is examined using its expression [32] in which N and P(m i ) refer to the total number and frequency of occurrences of symbol m i , respectively.
The entropy is reported in Table 4, and its value for encrypted images approaches the standard value 8, which means that the encrypted image is more random.This confirms the good performance of the scheme.The correlation coefficient (CC) is calculated using its expression [33] in which x and y are the pixel values.The CC is reported in Table 5.Looking at the values in Table 5, we can remark that the values of correlation coefficient in horizontal, vertical, and diagonal directions of the image approach the standard values (i.e., CC is 1 for initial biomedical images and 0 for their encrypted versions).This means that the correlation coefficients of the initial image are highly correlated and those for the encrypted image are uncorrelated.In conclusion, the designed encryption algorithm will resist statistical aggressions.

Histogram Study
The histogram should dispose uniformly for an encrypted image and randomly for an unencrypted one.Figure 15 illustrates the distribution of the pixels of biomedical images.The histogram should dispose uniformly for an encrypted image and randomly for an unencrypted one.Figure 15  From Figure 15, we can see that the histograms of the unencrypted images and those of the encrypted ones are completely different.The distribution of the pixels of the initial image is random and the one of the encrypted image is uniform, respecting the above From Figure 15, we can see that the histograms of the unencrypted images and those of the encrypted ones are completely different.The distribution of the pixels of the initial image is random and the one of the encrypted image is uniform, respecting the above characteristics.Thus, the biomedical image encryption system can resist differential attacks.6.3.5.Impacts of External Perturbations and Information Loss on the Performances of the Scheme Every encryption system is subjected to external perturbations and information loss.Therefore, it is necessary to study their impacts on the performance of the encryption system.Two different external perturbations, namely, Gaussian and Salt and Pepper noise, are subjected to the initial images before using them in the encryption system.The results for decrypted images are shown in Figure 16(a2(i)-a2(iii)) for Gaussian noise and  characteristics.Thus, the biomedical image encryption system can resist differential attacks.
6.3.5.Impacts of External Perturbations and Information Loss on the Performances of the Scheme Every encryption system is subjected to external perturbations and information loss.Therefore, it is necessary to study their impacts on the performance of the encryption system.Two different external perturbations, namely, Gaussian and Salt and Pepper noise, are subjected to the initial images before using them in the encryption system.The results for decrypted images are shown in Figure 16(a2(i)-a2(iii)) for Gaussian noise and Figure 16(b2(i)-b2(iii)) for Salt and Pepper noise.The intensity of each noise is indicated in the figure caption.Similarly, a part of the unencrypted image (see Figure 16(c1(i)-c1(iii)) is canceled before encryption.Figure 16(c2(i)-c2(iii)) present decrypted images.The percentage of the canceled data is indicated in the figure caption.(c2(i)-c2(iii)) corresponding decrypted images.
From Figure 16, we observe that, although a part of the initial image has been canceled and the noise has been subjected to the encryption system, the decrypted images remain exploitable.These results mean that the designed encryption algorithm has the ability to prevent noise and occlusion attacks.

NPCR and UACI Analysis
The performance of an encryption system is influenced by differential attacks.Common methods called NPCR and UACI are used to study their effects on the encryption system.They are expressed as [34]: , 100 .
NPCR and UACI are computed and their values are recorded in Table 6.From Figure 16, we observe that, although a part of the initial image has been canceled and the noise has been subjected to the encryption system, the decrypted images remain exploitable.These results mean that the designed encryption algorithm has the ability to prevent noise and occlusion attacks.

NPCR and UACI Analysis
The performance of an encryption system is influenced by differential attacks.Common methods called NPCR and UACI are used to study their effects on the encryption system.They are expressed as [34]: × 100 (11) in which d(i, j) is defined by: d(i, j) = 1, i f p(i, j) ̸ = p ′ (i, j), 0, else.
NPCR and UACI are computed and their values are recorded in Table 6.From the data in Table 6, we can conclude that the encryption system is impacted by small modifications of the image's pixels.This means that the studied image encryption algorithm has a strong capacity to resist differential attacks.

Comparison of this Scheme with Certain Recent Encryption Methods
The performance of the image encryption scheme is compared with that of certain recent studies and the comparisons are recorded in Table 7.The results of Table 7 confirm that the developed image encryption algorithm is more robust than some of the ones studied in recent works.

Conclusions
We designed a Hopfield neural network with a multistable memristor and its use for encoding biomedical image encryption.The equilibrium states, their stability, and the dynamics of the model were studied.Numerical simulations revealed that the model exhibits abundant and complicated comportments such as periodic orbits, chaos, and homogenous coexisting chaotic attractors.The model was realized using a microcontroller board.Numerical results and those obtained from the microcontroller looked very similar.The attractive behaviors of the Hopfield neural network were used to construct a scheme to mask images of cerebrovascular accidents, pulmonary fibrosis, and lung cancer.The performance of the scheme was verified by computing different statistical and security tests.
In future work, to construct a high-order neural network model that is closer to the biological one, we will use a non-polynomial memristor to couple two sub-neural networks.The two sub-neural networks will represent two different encephalic regions in the brain.
used to activate the neurons.
(7), the features of the equilibrium states P are studied based on the system parameters γ and ρ .The two functions are plotted in Figure3.The values of 0x and 0 y are determined at the intersections of the two function curves.

Figure 3 .
Figure 3. Determination of the equilibrium states 0 x and 0 y , which are indicated by the intersec-

Figure 3 .
Figure 3. Determination of the equilibrium states x 0 and y 0 , which are indicated by the intersections of two function curves.

Figure 4
Figure 4 shows the bifurcation diagram and Lyapunov exponents versus ρ com- puted from 1 to 2, for 0.7 γ =

Figure 4 .Figure 4
Figure 4. Influence of ρ on the behaviors of the model: (a) bifurcation diagram (b) Lyapunov ex- ponents for

Figure 5 .Figure 5 . 19 Figure 6 .
Figure 5. Phase spaces confirming the occurrence of chaos in the system for

Figure 10 .Figure 11
Figure 10.Hardware implementation devices.The dual-channel digital oscilloscope displays a cha otic attractor in the plane ( z

Figure 11
Figure 11 shows the route to chaos for a fixed value of γ and specific values of the coupling strength ρ.The results carried out from the microcontroller implementation (see Figure11) are very similar to those obtained from numerical simulations (see Figure5).This confirms that the Arduino Due microcontroller card is able to investigate the complete dynamics of the designed multistable memristor synapse-based coupled bi-Hopfield neuron model.

Figure 12
Figure 12 presents the encryption algorithm.

Figure 12 .
Figure 12.Complete diagram of the encryption algorithm.

Figure 12 .
Figure 12.Complete diagram of the encryption algorithm.

Figure 13 .
Figure 13.Numerical results: (a) initial image of cerebrovascular accident, (b) initial image of pulmonary fibrosis, (c) initial image of lung cancer, (d) encrypted image of cerebrovascular accident, (e) encrypted image of pulmonary fibrosis, (f) encrypted image of lung cancer, (g) decrypted image of cerebrovascular accident, (h) decrypted image of pulmonary fibrosis, (i) decrypted image of lung cancer.

Figure 13 .
Figure 13.Numerical results: (a) initial image of cerebrovascular accident, (b) initial image of pulmonary fibrosis, (c) initial image of lung cancer, (d) encrypted image of cerebrovascular accident, (e) encrypted image of pulmonary fibrosis, (f) encrypted image of lung cancer, (g) decrypted image of cerebrovascular accident, (h) decrypted image of pulmonary fibrosis, (i) decrypted image of lung cancer.

Figure 15 .
Figure 15.The distribution of the pixels of the unencrypted images (a), encrypted images (b), and decrypted images (c).

Figure 15 .
Figure 15.The distribution of the pixels of the unencrypted images (a), encrypted images (b), and decrypted images (c).

Figure 16 (
b2(i)-b2(iii)) for Salt and Pepper noise.The intensity of each noise is indicated in the figure caption.Similarly, a part of the unencrypted image (see Figure16(c1(i)-c1(iii)) is canceled before encryption.

Figure 16 (
c2(i)-c2(iii)) present decrypted images.The percentage of the canceled data is indicated in the figure caption.Electronics 2024, 13, x FOR PEER REVIEW 16 of 19

Table 1 .
A comparison of this work related to published ones.

Table 2 .
Equilibria and their stability.
As all p-values in Table3are greater than the standard value 0.001, all NIST tests are validated.

Table 4 .
Information entropies of initial images and their corresponding encrypted versions.

Table 4 .
Information entropies of initial images and their corresponding encrypted versions.

Table 7 .
Comparison of this image encryption scheme with certain recent encryption methods.