1 Introduction

The artificial Hopfield neural network (AHNN) is a model of artificial neural network that tends to mimic the memory function of the biological brain. It is a particularly intriguing model in that it attempts to replicate the critical mnemonic function in language mastery and the learning process. A significant number of artificial neural network models inspired by the initial model designed by Hopfield in 1984 have been developed to date. Despite its consideration of a large number of neurons, this model has this singularity in that it remains relatively simple. The studies carried out on AHNNs have the advantage that they would allow an understanding of a certain number of pathologies affecting memory function and provide a starting point for their resolution. As a result, dynamic behaviors such as chaos [1,2,3], hyperchaos [4,5,6], multistability [7,8,9], and hidden attractors [4, 5] have piqued the interest of researchers. Recent interesting works published in the literature, such as those of [10,11,12,13,14,15,16], can attest to the interest in the study of systems exhibiting such behaviors. For example, in [10], they investigated a chaotic Lorenz system modified by artificial neural networks, which allowed them to transform its chaotic behavior into motion, then create a chaotic motion video. The authors [11,12,13] applied an adaptive sliding mode control strategy, the passive control technique, and the indirect field control strategy to control the chaotic behavior of the dynamics of a fractional-order Hopfield neural network with memristor, a chaotic system, and a 3-phase induction motor, respectively. [14,15,16] proposed Jerk, memristive, and hyperjerk circuits, whose studies of the systems describing them presented chaotic attractors, periodic attractors, the coexistence of multiple attractors, bubbles of bifurcations, and many other phenomena. [15] has realized a chaos-based random number generator from the new memristive chaotic system they proposed and performed an algorithm for touchless fingerprint encryption has been established.

To facilitate theoretical analysis and experimental implementation, many small HNNs have been intensively studied [1, 3, 5, 17,18,19,20,21,22]. Complex dynamic behaviors such as periodic, chaotic, or coexisting attractors, crisis scenarios [1, 3, 5, 17,18,19,20, 22], hyperchaos [5, 6], relaxation oscillations [21], and hidden attractors [5], to name a few, have generally been revealed in these small HNNs. Most of these small HNNs listed are at least three-order autonomous [1, 3, 5, 17,18,19,20], but there are still other smaller non-autonomous and autonomous second-order ones that have been recently developed. As such, we can list the works of [23,24,25,26] who studied in-depth HNNs models with two neurons and highlighted complex dynamic behaviors. For example, the model investigated in [23] was able to exhibit in its non-autonomous model of HNN with two neurons a certain number of behaviors due to the stimulus. These include limit cycles, chaotic attractors, a bifurcation doubling the period, coexisting modes of bifurcations, and twin attractors. The latter is very useful for applications based on HNN in associative memory [27], image processing, and pattern recognition [28]. [24] subsequently considered a memristor as a synapse of self-connection of the previous non-autonomous model of two-neuron-based HNN studied in [23]. The memristor can remember the total electrical charge that passes through it over time [29]. This unique ability makes it behave like an electrical synapse in neural networks [30,31,32,33]. Several behaviors such as bursting and Hopf busters have been revealed by considering the memristor. [25, 26] constructed autonomous HNNs with ideal and non-ideal memristors, respectively, to emulate the effect of electromagnetic induction between two neurons. In [34], have recently proposed a fuzzy integral sliding mode technique for the synchronization and control of memristive neural networks. This control method combines a fuzzy logic controller with integral sliding mode control to provide fast and smooth results. In recent years, fractional calculus has provided reliable tools for the easy modeling of natural phenomena by the lightest possible equations. Moreover, the form of any real system is fractional. Precision in model formulation and sensitivity in design, require the need to treat neural systems as fractional-order differential equations. For this purpose, the dynamics of fractional order neural networks of Hopfield type have been studied by addressing notions such as stability and multi-stability (coexistence of several different stable states), bifurcations, and chaos [35]. Based on the stability analysis, the authors identified critical fractional-order values for which Hopf bifurcations may occur. The control methods for synchronizing a class of fractional-order neural networks have been devised by [36, 37]. [36] realized an adaptation mechanism that adjusts the parameters of the controller using an appropriate sliding surface, while [37] used the Lyapunov stability theorem. The authors [37] also proposed an algorithm for a new crypto-system based on the designed adaptive method for encryption / decryption of unmanned aerial vehicle color images.

The activation of neurons is most often ensured by a differentiated limited monotonic function, which plays a determining role in the appearance of complex dynamic behaviors in HNN [38]. The hyperbolic tangent function has been used to perform non-linear activation functions in small HNNs, previously named because of its feasibility because of the execution of the circuit [39,40,41]. Recently, Bocheng Bao et al. [18] took into account the effect of the activation gradient of the activation functions of neurons on the dynamics of a three-neuron-based HNN. The activation gradient, also called the gain in scale parameter, somehow translates the response speed of the neuron. The authors have thus demonstrated the implication of the activation gradient, which has hitherto been overlooked in the appearance of complex phonemes in network dynamics. Furthermore, phenomena such as coexisting limit cycle oscillations, attractors coexisting in chaotic spirals, chaotic double scrolls, and scenarios of crisis could thus be exhibited by considering the effect of the activation gradient. But the authors considered that all the activation gradients associated with the activation functions of the different neurons of their HNN were identical and linked. This is closer to the ideal case than the real. For example, a pathology that can considerably affect the balance in the response of the network. Furthermore, in their model, they did not analyze the effect that consideration of activation gradients on the network could have with the presence of a stimulus. It will be interesting for us here to take into account all these considerations in the model proposed by [23]. This model has the advantage that it is small because it consists of two neurons and already involves a stimulus. Therefore, it is extremely essential to study the effects of different activation gradients on the dynamic behavior of this small non-autonomous HNN. In this article, a two-neuron-based non-autonomous HNN with a sinusoidal stimulus involving different activation gradients associated with the activation functions of neurons is presented, in which the dynamic behaviours are related to activation gradients and include limit cycles, chaotic attractors, coexisting of twin attractors, a period-doubling bifurcation, and coexisting bifurcation modes. To get an idea of the effects of the fractional order derivative on its dynamics, the fractional version of the HNN is also considered.

The quick development of communications through the internet and computers has encouraged the design of secure encryption and decryption algorithms for transferred data. In this area of research, chaos-based encryption has received great attention from the scientific community [42]. Yu and collaborators are the first team to demonstrate that chaotic sequences can be exploited to generate a measurement matrix with restricted isometry property [43]. From this work, many authors have been attracted to the areas of chaos and compressive sensing for image compression and encryption. Zhou and collaborators proposed an image encryption scheme using a 1-D chaotic map [44]. Performance analysis indicated a secure algorithm able to withstand various forms of attack, but the encryption time is not acceptable. Ahmad et al. have designed a simple chaos-based permutation substitution encryption method to secure digital images in a cloud-based smart city environment [45]. Experimental results indicated a simple and secure algorithm. Hadi and co-workers proposed and analyzed a new fractional-order hyperchaotic memristor oscillator [46]. The oscillator is then applied to increase the key space of the voice encryption scheme. The proposed algorithm is hardly robust to brute force attacks, but it is observed that the encryption process is solely based on a simple x-or operation. Consequently, any type of attack except brute force attack can tackle the algorithm. Additionally, most of these algorithms are usually limited by the bandwidth saturation of the transmission channel as the data is not compressed at the sending end. Based on the above mentioned drawbacks, it is clear that the field of compressive sensing is not yet mature. Our work will try to solve some of these problems. It is observed that more and more huge data can be compressed and encrypted before transmission at reduced bandwidth. One of the most prominent compression encryption techniques has been demonstrated to be compressive sensing [47]. Zhou and co-workers used hyperchaotic sequences jointly with 2-D compressive sensing to design and analyze a new compression encryption algorithm. Chai and collaborators combined chaotic sequences, cellular automata, and ECA to design a block-based compressive sensing algorithm to compress and encrypt images [48]. The results indicated efficient and secured methods against some current cryptanalysis techniques. However, the key space of these algorithms is limited due to the use of a low-dimensional chaotic system with reduced complexity. Let us recall that in the compressive sensing process, compression is usually exploited to reduce the size of a given dataset with the aim of easing further processing in general or reducing the encryption time in this particular case [49]. In addition, it is well known that the more the signal is sparse, the easier it is to reconstruct. Strong sparse methods, such as local 2-D sparsity in the space domain, nonlocal 3-D sparsity in the transform domain, or a combination of local 2-D sparsity in the space domain and nonlocal 3-D sparsity in the transform domain, have been used by some authors [50]. These authors achieved good reconstruction performances, but the corresponding algorithms usually consume time and power. To solve this difficulty in this paper, we will apply a discrete wavelet transform (DWT) to achieve the sparsity property. Moreover, in compressive sensing, we need to use a measurement matrix that follows the restricted isometry property (RIP) [51]. Many compressive sensing algorithms have been proposed utilizing a variety of measurement matrices, including Gaussian random matrix, partial orthogonal matrix, Hadamard matrix, and circular matrix. These matrices are usually of a large size and cannot be constructed on the receiver side. Therefore, a problem with bandwidth is usual in these cases during the transmission process. To solve this problem, in this work, the measurement matrix of the proposed compressive sensing algorithm is designed using the sequences of the proposed chaotic system. The main contributions of this work can be summarized as:

  1. 1.

    Introduce a two-neuron model based on HNN with variable gradient under the influence of an external alternating current.

  2. 2.

    Use nonlinear analysis tools to show that the introduced HNN is able to exhibit more complex dynamical behaviour compared to the previous model.

  3. 3.

    Use the compressive sensing approach with chaotic sequences to compress and encrypt images. The plain color image is decomposed into R, G, and B components. The DWT is applied to each component to obtain the corresponding sparse components. Confusion keys are obtained from the proposed chaotic system to scramble each sparse component. The chaos-based measurement matrices are used to compress the confused sparse matrices corresponding to the R, G, and B components. Each component is quantified and a diffusion step is then applied to improve the randomness and, consequently, the information entropy.

  4. 4.

    The measurement matrix of the proposed compressive sensing is designed using the sequences of the proposed chaotic system. This method is applied to reduce bandwidth saturation given that most of the methods in the literature use communication channels to send the huge measurement matrix to the receiving/decryption end, thereby inducing saturation of the bandwidth.

The next sections of this article will be organized as follows: In Sect. 2, the connection topology considering the activation gradients and the mathematical model is described. The dissipative and symmetrical nature of the network are detailed there, the equilibrium points are illustrated graphically, and the determination of the characteristic equation from the Jacobian matrix is also presented. In Sect. 3, the dynamic behaviors associated with an activation gradient under the presence of the stimulus are revealed numerically by bifurcation diagrams and dynamic evolution in the parameter space as well as phase portraits. In Sect. 4, analog analyses are performed in Pspice to verify compliance with digital simulations. Section 5 presents compressive sensing-based image compression and encryption. Finally, in Sect. 6, the conclusions of this work are summarized and future directions are provided.

2 Model description

2.1 Proposed mathematical model involving neuron activation gradients

The form of the HNN involving an activation gradient for the two neurons is given in Eq. (1):

$$\begin{aligned} \dot{{x}}=-x+wtanh(\beta x)+I \end{aligned}$$
(1)

Where \(x=\left[ {x_{1} ,x_{2} } \right] ^{T}\) is the state vector of neurons,\(tanh(\beta x)=\left[ {tanh(\beta _{1} x_{1} ),tanh(\beta _{2} x_{2} )} \right] ^{T}\) are the activation functions of hyperbolic tangent-type neurons with adjustable gradients and w represents a synaptic weight matrix \(2\times 2\) describing the strength of the connections between the two neurons of the network and I is the sinusoidal stimulus\(I=I_{m} sin(2\pi F\tau )\).

The new HNN model that we propose is given by Eq. (1). The corresponding connection topology between the two neurons is represented in Fig. 1a. Figure 1b shows the internal connections of one neuron with its neighboring neurons. These internal connections involve the external connections coming from neighboring neurons and the self-connection weights associated with the activation function of the neuron, taking into account the gradient as well as the derivative of the state variable of the neuron considered. In contrast to the model proposed by [18], in this architecture, each neuron has an activation gradient independent of those of the other neurons. This consideration makes this model more flexible and allows the consideration of different electrical activities of neurons. The model considered by [23] can be found at any time, simply by considering the activation gradients of Eq. (1) all identical and equal to one.

$$\begin{aligned} w=\left[ {{\begin{array}{*{20}c} {w_{11} } &{} {w_{12} } \\ {w_{21} } &{} {w_{22} } \\ \end{array} }} \right] =\left[ {{\begin{array}{*{20}c} {-0.1} &{} {2.8} \\ {-k} &{} 4 \\ \end{array} }} \right] \end{aligned}$$
(2)

The mathematical model corresponding to the configuration of the synaptic weight matrix (2) is given by the following Eq. (3):

$$\begin{aligned} \left\{ {\begin{array}{l} \dot{{x}}_{1} =-x_{1} -0.1{\, }tanh(\beta _{1} x_{1} )+2.8{\, }tanh(\beta _{2} x_{2} )+I_{m} sin(2\pi F\tau )\\ \dot{{x}}_{2} =-x_{2} -k{\, }tanh(\beta _{1} x_{1} )+4{\, }tanh(\beta _{2} x_{2} ) \\ \end{array}} \right. \end{aligned}$$
(3)
Fig. 1
figure 1

Topological connection of a two-neuron-based Hopfield neural network (HNN) in (a); the detail diagram of a neuron to the involving gradient in (b)

2.2 Dissipation and symmetry

The evaluation of the dissipative nature of a system is based on the computation of the rate of contraction of the volume of this system over time [52, 53]. The system (3) can be written in the following vector form:

$$\begin{aligned}&\dot{{x}}=f(x,\tau )=\left[ {f_{1} (x_{1} ,x_{2} ,\tau ),f_{2} (x_{1} ,x_{2} )} \right] ^{T} \end{aligned}$$
(4)
$$\begin{aligned}&\text {With}\,\left\{ {\begin{array}{l} f_{1} (x_{1} ,x_{2} ,\tau )=-x_{1} -0.1{\, }tanh(\beta _{1} x_{1} )\\ +2.8{\, }tanh(\beta _{2} x_{2} )+I_{m} sin(2\pi F\tau ) \\ f_{2} (x_{1} ,x_{2} )=-x_{2} -k{\, }tanh(\beta _{1} x_{1} )+4{\,}tanh(\beta _{2} x_{2} ) \end{array}} \right. \nonumber \\ \end{aligned}$$
(5)

The divergence of the vector field f is given by the expression (6):

$$\begin{aligned} \nabla .f=\frac{\partial f_{1} }{\partial x_{1} }+\frac{\partial f_{2} }{\partial x_{2} } \end{aligned}$$
(6)

The divergence f measures how the volume changes rapidly under the flow \(\phi _{t} \) of f. Let Vbe a volume of the phase space and \(V(t)=\phi _{t} \left( V \right) \), the image of V by \(\phi _{t} \left( V \right) \). Liouville’s theorem or the divergence theorem states that:

$$\begin{aligned} \frac{dV(t)}{dt}=\int _{V(t)} {\left( {\nabla .f} \right) } .dx_{1} .dx_{2} \end{aligned}$$
(7)

With

$$\begin{aligned} \nabla .f= & {} -2-0.1\beta _{1} \left( {1-tanh^{2}(\beta _{1} x_{1} )} \right) \nonumber \\&+4\beta _{2} \left( {1-tanh^{2}(\beta _{2} x_{2} )} \right) \end{aligned}$$
(8)

For all \(\beta _{j} x_{j} (j=1,2)\), \(0\le \left( {1-tanh^{2}(\beta _{j} x_{j} )} \right) \le 1\), as \(-1\le tanh(\beta _{j} x_{j} )\le 1\) with an appropriate choice of gains \(\beta _{1} \) and \(\beta _{2} \)in (8) the divergence \(\nabla .f\) can be negative, thus the system can be also dissipative. Besides, the volume elements contract after a unit of time, which reduces a volume \(V_{0} \)by one factor \(exp(\nabla .f.t)\). As a result, all orbits in the system are eventually limited to a specific subset with a zero volume and the asymptotic movement settles on an attractor [54]. The system (3) is invariant at the change of coordinate \(\left( {x_{1} ,x_{2} ,\tau } \right) \leftrightarrow \left( {-x_{1} ,-x_{2} ,-\tau } \right) \), it means that it is symmetric. This symmetry will be at the origin of the appearance of paired solutions in the network by a change of sign of the initial conditions [55].

2.3 Equilibrium points and stability related to gradient values

The equilibrium points of system (3) are obtained by making its left-hand member equal to zero at \(\tau =0\), this amounts to solving the system of equations given by expression (9):

$$\begin{aligned} \left\{ {\begin{array}{l} 0=-x_{1e} -0.1{\, }tanh(\beta _{1} x_{1e} )+2.8{\, }tanh(\beta _{2} x_{2e} ) \\ 0=-x_{2e} -k{\, }tanh(\beta _{1} x_{1e} )+4{\, }tanh(\beta _{2} x_{2e} ) \\ \end{array}} \right. \end{aligned}$$
(9)

After developments and arrangements of the system given in (9), the equilibrium points (trivial and non-trivial) are obtained by expression (10) referred to as the graphical approach [18, 23] applied using MATLAB:

$$\begin{aligned} P_{n} =\left( {x_{1e}^{n} ,\frac{10}{7}x_{1e}^{n} +\left( {\frac{1}{7}-k} \right) tanh(\beta _{1} x_{1e}^{n} )} \right) \end{aligned}$$
(10)

Where \(n\in {\mathrm{N}}\) is the numbering index of equilibrium points \(x_{1e}^{n} \), which corresponds to the graphical intersections with the abscissa of the solution curve represented by Eq. (11):

$$\begin{aligned} S(x_{1e} )= & {} -x_{1e} -0.1{\, }tanh(\beta _{1} x_{1e} )\nonumber \\&+2.8{\, }tanh\left[ {\beta _{2} \left( {\frac{10}{7}x_{1e} +\left( {\frac{1}{7}-k} \right) tanh(\beta _{1} x_{1e} )} \right) } \right] \nonumber \\ \end{aligned}$$
(11)

Equations (10) and (11) depend on the activation gradients (\(\beta _{j=1,2} )\) of the neurons. The curves presented in Fig. 2 represent different electrical activities of the neurons, which are hyperbolic tangent functions. These curves plotted in Fig. 2 imply a standard gradient for \(\beta _{j} =1\) (whose standard gain curve), weak fo r \(\beta _{j} <1\) (whose flat sigmoid gain curve), and high for \(\beta _{j} >1\) (whose step-like gain curve) which corresponds to electrical activities of standard neurons, slow and fast, respectively [18, 56]. For standard gradients (\(\beta _{j=1,2} =1)\), the solution curves are given in Fig. 3a which is in accordance with those obtained by [18] forthree different values of the parameter k. From that figure, there is only one intersection point for \(k>2.1896\), five intersection points for \(k<2.1896\) and three intersections for a critical value \(k=2.1896\) corresponding respectively to one, five, and three equilibrium points. Now let’s consider \(k=2.385\) that corresponding to only one trivial equilibrium point. Figure 3b, c, show the influence of the activation gradients of the first (\(\beta _{1} )\) and second (\(\beta _{2} )\) neurons respectively on the solution curves. The results provided in Fig. 3b, c show that the equilibrium points change from only one to three, then to five when the values of the activation gradients of the first and second neurons are decreased and increased, respectively. These changes are undergone by the solution curves according to the values of the activation gradients of the first and second neurons, which are favorable for the transition from only one to three, then to five intersections of the solution curve with abscissa. From this observation, it is easy to choose which gradient to act on to obtain consequent electrical activity in the network.

Fig. 2
figure 2

The existence of three different nonlinearities in hyperbolic tangent activation is due to low (in blue), standard (in red) and fast (in green) gradients

The Jacobian matrix derived from Eq. (3), for equilibrium points \(P_{n=0,1,2,3,4} \) is given in (12):

$$\begin{aligned} J=\left[ {{\begin{array}{*{20}c} {-{\, }1-0.1\beta _{1} g(\beta _{1} \bar{{x}}_{1} )} &{} {2.8\beta _{2} g(\beta _{2} \bar{{x}}_{2} )} \\ {-k\beta _{1} g(\beta _{1} \bar{{x}}_{1} )} &{} {-{\, }1+4\beta _{2} g(\beta _{2} \bar{{x}}_{2} )} \\ \end{array} }} \right] \end{aligned}$$
(12)
Fig. 3
figure 3

The function curve described by Eq. 11 and their intersection points with respect to gradients \(\beta _{j=1,2} =1\) in (b); equilibrium points varying with respective gradients \(\beta _{1} \) and \(\beta _{2} \) in (c) and (d) respectively

The characteristic equation associated with (12), specified in Eq. (13), is obtained from the MATLAB software:

$$\begin{aligned} det(J-\lambda I_{2} )=a_{2} \lambda ^{2}+a_{1} \lambda ^{1}+a_{0} =0 \end{aligned}$$
(13)

Where,

$$\begin{aligned} \left\{ {\begin{array}{l} a_{2} =1 \\ a_{1} =\beta _{1} g(\beta _{1} \bar{{x}}_{1} )/10-4\beta _{2} g(\beta _{2} \bar{{x}}_{2} )+2 \\ a_{0} =\beta _{1} g(\beta _{1} \bar{{x}}_{1} )/10-4\beta _{2} g(\beta _{2} \bar{{x}}_{2} )+\left( {14k-2} \right) \beta _{1} \beta _{2} g(\beta _{1} \bar{{x}}_{1} )g(\beta _{2} \bar{{x}}_{2} )/5+1 \\ \end{array}} \right. \end{aligned}$$
(14)

With,

$$\begin{aligned} g(\beta _{j} \bar{{x}}_{j} )=Sec(\beta _{j} \bar{{x}}_{j} )^{2}=1-(tanh(\beta _{j} \bar{{x}}_{j} ))^{2}j=1,2\nonumber \\ \end{aligned}$$
(15)

The coefficients of the characteristic polynomial (14) are all non-zero. The equilibrium points \(P_{n=0,1,2,3,4} \) will be stable if only if for all the values \(a_{1} >0\) and \(a_{0} >0_{\, }\) according to the Routh-Hurwitz criterion. For the specific case of the trivial equilibrium point \(P_{0} =\left( {0,0} \right) \), we have the stability if the conditions (16) are respect if not \(P_{0} \) will unstable.

$$\begin{aligned} \left\{ {\begin{array}{l} \beta _{1}>10\left( {4\beta _{2} -2} \right) \\ k>\frac{1}{7}+\frac{\left( {40\beta _{2} -\beta _{1} -10} \right) }{28\beta _{1} \beta _{2} } \\ \end{array}} \right. \end{aligned}$$
(16)

The activation gradients will be \(\beta _{2} =1\), \(\beta _{1} =tuneable\) and \(k=2.385\), \(I_{m} =2.5\), \(F=0.1\) in the rest of the document unless otherwise indicated. For this configuration, the trivial equilibrium point \(P_{0} \) will be unstable for \(\beta _{1} <20\) and stable for\(\beta _{1} >20\).

The computation of the corresponding eigenvalues is carried out in Table 1 for some values of the gradient \(\beta _{1} \). This table shows that the nature of stability of the trivial equilibrium varies with respect to \(\beta _{1} \) and is of type Hopf bifurcation point for \(\beta _{1} =20\) because the eigenvalues are pure imaginary.

Table 1 Eigenvalues and stabilities concerning the trivial equilibrium point \(P_{0} \left( {0,0} \right) \) for some values of \(\beta _{1}\)
Fig. 4
figure 4

Bifurcation diagrams (a) and corresponding largest Lyapunov exponent (b) show the local maximal of \(x_{2} \) as a function of gradient \(\beta _{1}\)

Table 2 Methods used to obtain coexisting bifurcation diagrams of Fig. 4 and its enlargements of Fig. 5

3 Numerical results

The numerical integrations are based on the 4th order Runge-Kutta algorithm for the precision and speed of convergence with an integration time step \(\Delta \tau =0.005\). The plot of the bifurcation diagram consists of taking the local maxima of the variable during the variation of the activation gradient of the first neuron, performed on the integration time interval \(1500\le \tau \le 2000\) for a time step \(\Delta \tau =0.005\). The plot of the largest Lyapunov exponent diagram is done using the Wolf method in the time interval \(9000\le \tau \le 10,000\) with the time step \(\Delta \tau =0.005\) [57].

3.1 Bifurcation diagrams and phase portraits

The superimposition of the bifurcation diagrams in Fig. 4a shows the effect induced by the variation of the first neuron gradient through electrical activities on the dynamics of the model (3) in the range of \(0.6\le \beta _{1} \le 1.8\). It is easy to see in this diagram the evolution of the activation gradient (\(\beta _{1} )\), the appearance of the zones of periodic behaviours, followed by zones of chaotic behaviours. The Wolf algorithm [57] was used to generate the superimposed diagrams of the largest Lyapunov exponents in Fig. 4b, which confirms the observed bifurcations. The computational method used for those bifurcation diagrams is provided in Table 2. For different discrete values of the gradient, some phase portraits can be represented concerning the limit cycles and chaotic attractors in the \((x_{1} -x_{2} )\) plane.

An enlargement of two of the periodic windows of the bifurcation diagram of Fig. 4a is shown in Fig. 5 for the activation gradient belonging to the ranges of \(1.218\le \beta _{1} \le 1.29\) and \(1.231\le \beta _{1} \le 1.233\). Figure 5a, b depict the coexistence of four bifurcation diagrams that differ in a variety of ways. These diagrams argue for the existence of the phenomenon of multistability in these ranges. The methods and initial conditions for obtaining these diagrams are given in Table 2.

Fig. 5
figure 5

Enlargement of bifurcation diagram Fig. 4a, b exhibiting the coexistence of four different bifurcation diagrams

3.2 Coexistence of attractors and basins of attraction

The notion of multistability, or coexistence of multiple attractors, is a very important phenomenon in chaotic dynamical systems because of the flexibility it offers the system and its adapted applications in information engineering [19, 58, 59]. Multistability has caught the attention of many researchers in recent years [60,61,62,63,64], because it encompasses a diversity of many stable states in a system. The study of the coexistence of attractors in the HNNs would allow an understanding in depth of its dynamic effect on the aspects of the treatment of brain information and cognitive function [19]. We have highlighted through the HNN model given in Eq.(3) the coexistences of periodic and chaotic twin attractors, considering the activation gradient values \(\beta _{1} =1.2182\) and \(\beta _{1} =1.232_{\, }\) respectively, as presented in Figs. 6 and 7. The basins of attraction that enable us to obtain each of the coexisting attractors are shown in Fig. 8. As it can be seen on these attraction basins, four different colors enable us to further support the coexisting attractors presented previously.

These basins of attraction correspond to those of the self-excited attractors because they intercede with the open neighborhood of other equilibrium points. This is not the case for hidden attractors whose basins of attraction do not cross the open neighborhood of the other points of equilibrium. Let us note here that the coexistence of more than two attractors in the small models of HNNs with two neurons was raised with the consideration of the memristor as weight, which increases the complexity of the model. Therefore, the consideration of the gradient makes this small model of HNN with two neurons the simplest in the world, showing on the one hand, the coexistence of more than two attractors and, on the other hand, twin attractors. This demonstrates to our satisfaction that taking unbalanced gradients into account makes the model (3) in terms of behavior more complex and interesting than those already existing, considering gradients identical or not. As a result, the model (3), which allows for the coexistence of two twin attractors (see Figs. 6 and 7), can constitute a storage mechanism with a higher capacity than existing similar small models.

Fig. 6
figure 6

Coexistence of two twin attractors at \(\beta _{1} =1.2182\): a, b shows period-9 twin attractors and chaotic twin attractors, respectively. The initial-conditions for these attractors are \(\left( {x_{1} (0),x_{2} (0)} \right) =(0,{+1.76} /{-2})\) and \((0.1,{+2}/{-1}.76)\) respectively

Fig. 7
figure 7

Coexistence of two twin attractors at \(\beta _{1} =1.232\): a, b shows period-7 twin attractors and chaotic twin attractors respectively. The initial-conditions for these attractors are \(\left( {x_{1} (0),x_{2} (0)} \right) =(0,\pm 1.2)\) and \((0,\pm 1.6)\) respectively

Fig. 8
figure 8

Cross sections of the basin of attraction corresponding to the coexisting of the twin attractors of Figs. 6 and 7 with colors respectively

3.3 Gradients in the parameter space

Figure 9 shows the effect of the variation of two different activation gradients of the neurons on the dynamics of the model of HNN (3) exposed in the parameter space in the \(\left( {\beta _{1} ,\beta _{2} } \right) \) plane. We can note from Fig. 9a that the dynamics of the HNN (3) has two main distinct regions, one chaotic in red and the other periodic in blue, where the periodic region is dominant. The coded colors contained in Fig. 9b correspond to values of the maximum Lyapunov exponent \((\lambda _{\max } )\). These values are indicated on the graduations of the color bar of the corresponding figure. In this figure, we can appreciate the effects of the electrical activities in the network (3) via transitions of the zones of periodic behaviours (where \(\lambda _{\max } <0)\) towards areas of chaotic behaviours (where \(\lambda _{\max } >0)\) and vice versa during the variation of activation gradients.

Fig. 9
figure 9

Influence of the variation of two neuron activation gradients \(\left( {\beta _{1} ,\beta _{2} } \right) \), to the dynamical behaviors

4 Circuit design

In this section, the HNN (3) model will be studied in the form of a circuit or an analog calculator in PSpice. The analog calculator equivalent to the mathematical model (3) is set up essentially by electronic components. This rigorous and inexpensive strategy is employed because it has been used for experimental studies of some existing systems [19, 20] or to emulate other complex systems [1, 65,66,67]. Furthermore, such a theoretical model plays a significant role in practical chaos-based applications such as secure communications, the random number generator, and trajectory planning for autonomous robots [68, 69].

4.1 Analog circuit synthesis for neuron activation function involving gradients

The nonlinear terms involving the two activation gradients of each neuron involved in the model (3) are realized by two hyperbolic tangent functions with adjustable independent gains. The design of the HNN (3) model must necessarily have gone through the setting up of modules realizing the hyperbolic tangent functions with activation gradients (see Eq. 3). Based on the circuit diagram shown in [18], the modules allowing the synthesis of these functions are obtained (see Fig. 10a). This circuit uses a pair of differential transistors, two operational amplifiers, a voltage source, a current source, and eight resistors.

$$\begin{aligned} tanh\left( {\frac{R_{\beta _{j} } }{2RV_{T} }V_{in} } \right) =tanh\left( {\beta _{j} V_{in} } \right) \end{aligned}$$
(17)

With

$$\begin{aligned} \beta _{j} =\frac{R_{\beta _{j} } }{2RV_{T} } \end{aligned}$$
(18)

Where, \(V_{in} \) is the input voltage of the module, \(V_{T} =26mV\) is the thermal voltage of the transistors, \(R_{\beta _{j} } \) is a variable resistor to adjust the gain \(\beta _{j} (j=1,2)\), \(R=10k\,\Omega \) and \(R_{C} =1k\,\Omega \) fixed resistors. The values of the supply voltages and the constant currents of the modules are \(+Vcc=15V\) and \(I_{0} =1.1mA\) respectively [39]. The resistance values for adjusting the gradients are set in (19):

$$\begin{aligned} R_{\beta _{1} }= & {} 2RV_{T} \beta _{1} =520\times 1 \nonumber \\= & {} 520\Omega \text { and } R_{\beta _{2} } =tuneable \end{aligned}$$
(19)

4.2 Analog circuit synthesis for the HNN-2 model involving gradients

Referring to [18, 23], the analog circuit of the HNN model (3) consists of two integrators involving two inverters in feedback loops and variable gain hyperbolic tangent functions, as shown in Fig. 10b.

$$\begin{aligned} \left\{ {\begin{array}{l} C_{1} \frac{dX_{1} }{dt}=-\frac{X_{1} }{R}-\frac{1}{R_{1} }tanh(\beta _{1} X_{1} )+\frac{1}{R_{2} }tanh(\beta _{2} X_{2} )+\frac{A}{R}sin(2Pift) \\ C_{2} \frac{dX_{2} }{dt}=-\frac{X_{2} }{R}-\frac{1}{R_{3} }tanh(\beta _{1} X_{1} )+\frac{1}{R_{4} }tanh(\beta _{2} X_{2} ) \\ \end{array}} \right. \end{aligned}$$
(20)

Where \(X_{1} \) and \(X_{2} \) denote capacitor voltages \(C_{1} \) and\(C_{2} \) respectively; with \(C_{1} =C_{2} =C=100nF\) and \(R=10k\,\Omega \).

The system of Eq. (20) is equivalent to (3) considering the following equalities:

$$\begin{aligned} t= & {} \tau RC,X_{i} =x_{i} (i=1,2),\nonumber \\ R_{1}= & {} \frac{R}{\left| {w_{11} } \right| }=100k \Omega ,\nonumber \\ R_{2}= & {} \frac{R}{\left| {w_{12} } \right| }=3.571k\,\Omega ,\nonumber \\ R_{3}= & {} \frac{R}{\left| {w_{21} } \right| }=4.193k\,\Omega \text { and } \nonumber \\ R_{4}= & {} \frac{R}{\left| {w_{22} } \right| }=2.5k\,\Omega ,\nonumber \\ A= & {} I_{m} \text { and}\,f=\frac{F}{RC}=100Hz \end{aligned}$$
(21)
Fig. 10
figure 10

Synthesized hyperbolic tangent functions with adjustable gradient by \(R_{\beta _{j} } \) (a); analog circuit of the two-neuron-based Hopfield Neural Network in (b)

4.3 Validation by PSpice analog simulation

The implementation of the analog circuits of Fig. 10 in PSPICE has led to the results of Fig. 11. The coexistence of two twin attractors of different types is shown in this figure, in (a) a period-7 twin attractor and in (b) chaotic twin attractors whose initial conditions are \(V(X_{1} (0),X_{2} (0))=(0.1,{+0.1}/ {-0.4})\) and \((0.1,\pm 4.1)\) respectively. These coexisting attractors are similar to the ones obtained following the numerical approach in Fig. 7 [22, 70, 71]. All these results were obtained by considering Final step: 680ms; No-Print Delay: 500ms; Step Ceiling: 2\(\upmu \mathrm{s}\) and setting the variable resistor at \(R_{\beta _{1} } =532.9\Omega \).

Fig. 11
figure 11

Coexistence of two twin attractors obtained in PSPICE with \(R_{\beta _{1} } =532.9\Omega \): a, b shows period-7 twin attractors and chaotic twin attractors respectively. The initial-conditions for these attractors are \(V(X_{1} (0),X_{2} (0))=(0.1,{+0.1}/{-0.4})\) and \((0.1,\pm 4.1)\) respectively

5 Fractional-order of the HNN model

Caputo’s derivative is one of the commonly used methods for solving fractional differential equations, [72] which is defined as

$$\begin{aligned}&{ }_{t_{0} }^{\mathcal{C}} D_{t}^{\alpha } f\left( t \right) =\frac{1}{\Gamma \left( {n-\alpha } \right) }\int _{t_{0} }^t {\frac{f^{\left( n \right) }\left( \tau \right) }{\left( {t-\tau } \right) ^{\alpha -n+1}}\text {d}\tau } , \quad \nonumber \\&\quad n-1<\alpha <n \end{aligned}$$
(22)

Where \(\Gamma (\bullet )\) is a gamma function with the form of \(\Gamma \left( \alpha \right) =\int _0^{+\infty } {t^{\alpha -1}e^{-t}dt} \) and the simple form of Caputo’s derivative is expressed as follows when the positive integer is \(n=1\) [73]

$$\begin{aligned} { }_{t_{0} }^{\mathcal{C}} D_{t}^{\alpha } f\left( t \right) =\frac{1}{\Gamma \left( {1-\alpha } \right) }\int _{t_{0} }^t {\left( {t-\tau } \right) ^{-\alpha }f^{\left( 1 \right) }\left( \tau \right) \text {d}\tau }\nonumber \\ \end{aligned}$$
(23)

Using Caputo’s derivative, the fractional-order model of HNN introduced in Eq. (3) is given in Eq.(24)

$$\begin{aligned} \left\{ {\begin{array}{l} D^{q}x_{1} =-x_{1} -0.1{\, }tanh(\beta _{1} x_{1} )+2.8{\, }tanh(\beta _{2} x_{2} )+I_{m} sin(2\pi F\tau ) \\ D^{q}x_{2} =-x_{2} -k{\, }tanh(\beta _{1} x_{1} )+4{\, }tanh(\beta _{2} x_{2} ) \\ \end{array}} \right. \end{aligned}$$
(24)

When \(\beta _{2} =1\), \(\beta _{1} =1 \quad k=2.385\), \(I_{m} =2.5\), \(F=0.1\), and \(q=tuneable\) the effect of the variation of the order is explore on the dynamics of the considered HNN as presented in Fig. 12

Fig. 12
figure 12

Phase diagrams showing the evolution of the dynamical behavior of the considered HNN under the variation of the order of the model

In that figure, for the considered set of parameters, the HNN model displays a symmetric chaotic attractor when \(q=1\). When q is reduced, the HNN model moves from a symmetric chaotic attractor to an asymmetric chaotic attractor. When that control parameter is further reduced, the HNN model moves from an asymmetric chaotic to a periodic attractor. This transition is further justified by the bifurcation diagram of Fig. 13a.

Fig. 13
figure 13

Bifurcation diagram showing the general behavior of the system when q and \(\beta _{1} \) are varied. The diagram in a is obtained for \(\beta _{1} =1\), with \(0.98\le q\le 1\). while those in b are obtained for \(q=0.998\), with \(0.6\le \beta _{1} \le 1.8\)

When Comparing Fig. 13b with Fig. 4a, the modification of the order of the HNN \(\left( {q=0.998} \right) \) allows to change the transition toward chaos observed in the considered model when the order was considered at \(q=1\).

6 Application to compressive sensing based image encryption

6.1 Compressive sensing

Compressive sensing is a prominent sampling-reconstruction technique that achieves compression during the sampling stage. This technique is used when the data meets the sparsity property in some domains. Generally, a given input signal is first represented on an orthogonal basis to meet the sparsity property [74]. Then a measurement matrix is used to sample only the components that best define the input signal. A reconstruction technique is used to recover the original signal.

Let us consider an orthogonal basis \(\psi =[\psi _{1} ,\psi _{2} ...\psi _{n} ]\) where a signal x can be represented as:

$$\begin{aligned} x=\sum \limits _{j=1}^n {\alpha _{j} \psi _{j} } =\psi \alpha \end{aligned}$$
(25)

Where \(\alpha =\psi ^{T}x\) is the representation of x in the orthogonal basis\(\psi \). If \(\alpha \) contain \(k\left( {k\le n} \right) \) nonzero coefficients then \(\alpha \) is said to be k-sparse. For a sparse signal, the compressive sensing approach is directly applied to the signal. But if the signal is not sparse, a transformation can be applied to achieve the sparsity property. Let us recall that compression is usually used to reduce the size of a given dataset to ease further processing in general or reduce the encryption time in this particular case [49]. In addition, it is well known that, the more the signal is sparse, the easier its reconstruction. Strong sparse methods, such as local 2-D sparsity in the space domain, non-local 3-D sparsity in the transform domain, or a combination of local 2-D sparsity in the space domain and non-local 3-D sparsity in the transform domain, have been used by some authors [50]. These authors achieved good reconstruction performances, but the corresponding algorithms usually consume time and power. In this paper, we will apply the discrete wavelet transform (DWT) to achieve the sparsity property. When this sparsity property is satisfied a vector y of size \(m\times 1\) is linearly obtained from x as follows:

$$\begin{aligned} y=\Phi x=\Phi \psi \alpha =\Omega \alpha \end{aligned}$$
(26)

Where \(\Omega \) is the sensor matrix defined as the product of the orthogonal basis \(\psi \) with the measurement matrix \(\Phi \) (of size \(m\times n)\). Note that to recover the original x the sensor matrix \(\Phi \) must satisfy the restricted isometry property as defined in [75]. The main problem of compressive sensing is to recover x from y. to achieve this goal the following optimization problem should be solved:

$$\begin{aligned} \min \left\| \alpha \right\| _{1} \,\,\,\text {subjected}\,\,\,to\,\,\,y=\Phi \psi \alpha \end{aligned}$$
(27)

To solve the problem defined in Eq. (27) reconstruction algorithms are usual including matching pursuit (MP) [76], orthogonal matching pursuit (OMP) [76], subspace pursuit (SP), smooth l\(_{0}\) algorithm (SL\(_{0})\) [77], Newton smoothed l\(_{0}\) norm (NSL\(_{0})\) [77]. In this work, we selected orthogonal matching pursuit (OMP) to recover the signal as it is one of the most efficient reconstruction methods. The measurement matrix is designed using a circular matrix based on the chaotic sequence. This technique is used to avoid bandwidth saturation with the measurement matrix and, consequently, to decrease the overall computational complexity.

6.2 Compression-encryption method

In this section, we deal with the encryption method based on compressive sensing. The plain color image is decomposed into red (R), green (G), and blue (B) components. The discrete wavelet transform is applied to each component to obtain the corresponding sparse components. Confusion keys are obtained from the above proposed chaotic system to scramble each sparse component. The measurement matrices obtained from the chaotic sequence are used to compress the confused sparse matrices corresponding to the R, G, and B components. Each component is quantified and a diffusion step is finally applied to improve the randomness and, consequently, the information entropy. The following steps describe the whole compression encryption scheme. Note that as the proposed scheme is symmetric, the decryption process is the reverse of the encryption scheme.

Fig. 14
figure 14

Block diagram of the compressive sensing based encryption

Step 1: Read the plain color image of size (\(h\times n)\) and decompose to various R, G and B components. Then apply DWT to these components to achieve the sparse matrices R\(_{S}\), G\(_{S,}\) and B\(_{S}\).

Step 2: Using initial seed and parameters as indicated by Fig. 7b solve the system and store chaotic sequences as \(X_{1i} \) and \(X_{2i} \) each with \(h\times n\) elements then permute the sparse matrices as follow:

  1. (a)

    Sort the elements of sequences \(X_{1i} \) and \(X_{2i} \) in ascending order respectively as \(S_{1i} \,\,=\,\,sort(X_{1i} )\) and \(S_{2i} \,\,=\,\,sort(X_{2i} )\).

  2. (b)

    Obtain the indexes of each element of sequence \(S_{1i} \) in sequence \(S_{2i} \) as \(I_{i} =index(S_{1i} \,\,in\,\,S_{2i} )\).

  3. (c)

    Apply swap function to scramble the positions of pixels in the sparse matrices R\(_{S}\), G\(_{S,}\) and B\(_{S}\) as:

    $$\begin{aligned} R_{p}= & {} swap(R_{s} ,I) \\ G_{p}= & {} swap(G_{s} ,I) \\ B_{p}= & {} swap(B_{s} ,I) \end{aligned}$$

    Step 3: Using initial seed and parameters as indicated by Fig. 7b solve the system and store chaotic sequences as \(X_{1i} \) and \(X_{2i} \) each with \(m\times n\) elements where \(m=floor(CR\times h)\) and CR is the compression ratio. Then use these sequences to design the measurement matrix as:

    1. (a)

      Combine the chaotic sequences \(X_{1i} \) and \(X_{2i} \) to achieve new random sequence \(Y_{i} \) defined as:

      $$\begin{aligned} Y_{i} =\frac{X_{1i} +X_{2i} }{2} \end{aligned}$$
      (28)
    2. (b)

      Apply equidistant sampling on the random sequence \(Y_{i} \) to achieve new random sequence \(Y_{i}^{\,'} \) as:

      $$\begin{aligned} Y_{i}^{\,'} =1-2Y_{2+is} \end{aligned}$$
      (29)

      Where s is the sampling interval and \(i=0,1,2,.......m\times n\).

    3. (c)

      The final measurement matrix of size \(m\times n\) is obtained by quantifying the sequence \(Y_{i}^{\,'} \) as:

      $$\begin{aligned} \Phi =\sqrt{\frac{2}{h}} \left( {{\begin{array}{*{20}c} {Y_{11}^{\,'} } &{} \cdots &{} {Y_{1n}^{\,'} } \\ \vdots &{} \ddots &{} \vdots \\ {Y_{m1}^{\,'} } &{} \cdots &{} {Y_{mn}^{\,'} } \\ \end{array} }} \right) \end{aligned}$$
      (30)

      Where \(\sqrt{\frac{2}{h}} \) is used for normalization.

Step 4: Measure each permuted red (\(R_{p} )\), green (\(G_{p} )\) and blue (\(B_{p} )\) components using the measurement matrix to obtain the measured components \(R_{m} ,\,G_{m} \) and \(B_{m} \) as:

$$\begin{aligned} R_{m}= & {} \Phi R_{P} \nonumber \\ G_{m}= & {} \Phi G_{P} \nonumber \\ B_{m}= & {} \Phi B_{P} \end{aligned}$$
(31)
Fig. 15
figure 15

Result of compression and encryption of four different images. The compression ratio is CR\(=\) 0.5

Table 3 Peak Signal-to-Noise Ratio (PSNR) of some test images with respect to the variation of the compression ratio (CR)

Step 5: Apply quantization on each measured component \(R_{m} ,\,G_{m} \) and \(B_{m} \) as:

$$\begin{aligned} R_{Q}= & {} floor\left[ {\frac{255\times (R_{m} -\min (R_{m} ))}{\max (R_{m} )-\min (R_{m} )}} \right] \nonumber \\ G_{Q}= & {} floor\left[ {\frac{255\times (G_{m} -\min (G_{m} ))}{\max (G_{m} )-\min (G_{m} )}} \right] \nonumber \\ B_{Q}= & {} floor\left[ {\frac{255\times (B_{m} -\min (B_{m} ))}{\max (B_{m} )-\min (B_{m} )}} \right] \end{aligned}$$
(32)

Step 6: After quantization the obtained matrices present poor entropies values. To solve the problem the matrices \(R_{m} ,\,G_{m} \) and \(B_{m}\) are confused as:

$$\begin{aligned} R_{c}= & {} R_{Q} \oplus I \nonumber \\ G_{c}= & {} G_{Q} \oplus I \nonumber \\ B_{c}= & {} B_{Q} \oplus I \end{aligned}$$
(33)

Step 7: Combine \(R_{c} \), \(G_{c} \) and \(B_{c} \) to get the final cipher image.

6.3 Results and analyses

Four different images are employed to evaluate the proposed compression encryption technique. The working environment is composed of 64 bits laptop equipped with Intel Core\(^{\mathrm{TM}}\) i7-3630QM, 16GB RAM, a 2.6GHz CPU, and provided with MATLAB R2016b. The chaotic system is solved with parameters and initial conditions as in Fig. 7b. The results are presented in Fig. 15.

6.3.1 Performances of compression

In order to evaluate the performance of compression and reconstruction in the compression-encryption scheme under consideration, four different images are considered and the tests are conducted with various compression ratios (CR\(=\)0.2, CR\(=\)0.2, CR\(=\)0.3, CR\(=\)0.4, CR\(=\)0.5, CR\(=\)0.6, CR\(=\)0.7, CR\(=\)0.8, CR\(=\)0.9). Then the Peak Signal-to-Noise Ratio (PSNR) values between the plain image and the reconstructed image are computed in decibels as indicated by Eq. 34.

$$\begin{aligned} PSNR=10\log \frac{255^{2}}{(1/mn)\mathop {\sum }\nolimits _{i=1}^m {\mathop {\sum }\nolimits _{j=1}^n {[P(i,j)-D(i,j)]} } }\nonumber \\ \end{aligned}$$
(34)

where P and D represent the pixel values of the plain and the decrypted images, respectively. The results are presented in Table 3 and Fig. 16. From these results, the PSNR values are above 30 dB showing high reconstruction performances. The PSNR value obtained in this work in the particular case of Image 1 for CR\(=\)0.5 is compared to some recent works in the literature (Table 4). The common base of comparison with the selected references is the utilization of chaos/ hyperchaos based pseudorandom sequences in the process. But the particularity of our case is that these sequences are from the dynamics of an adjustable gradient HNN. From this comparison, our algorithm is better than those of Refs [75, 78,79,80] in terms of reconstruction of the compressed image.

Fig. 16
figure 16

Peak Signal-to-Noise Ratio (PSNR) of some test images with respect to the variation of the compression ratio (CR)

Table 4 Comparative analysis with respect to PSNR values at CR\(=\)0.5

6.3.2 Histogram

A histogram test is applied to evaluate the distribution of each pixel in the image [70, 81]. Usually, the histogram of a given plain image is randomly distributed, whereas the histogram of the corresponding cipher is uniformly distributed. To evaluate the robustness of the proposed encryption against histogram-based attacks, one image is selected among the test data (Image 1). The histogram of the said image is computed and represented in Fig. 17 with the corresponding cipher in the red (R), green (G), and blue (B) planes. It is obvious that the uniformly distributed histogram belongs to the cipher image, and consequently, the proposed technique can resist attacks based on histogram analysis. Let us mention that this test can also be conducted for the rest of the test data (Image 2, Image 3, and image 4).

Fig. 17
figure 17

Histogram of Image 1: The first row represents the plain image in the red (R), green (G) and blue (B) planes, and the second row represents the corresponding cipher in the red (R), green (G) and blue (B) planes

6.3.3 Correlation coefficients

The correlation coefficient of adjacent pixels\(C_{mn} \) is one of the major tools used to evaluate the distribution of a given pixel with its neighbouring pixels in horizontal, vertical, and/or diagonal directions [71, 82]. Usually, the values of the correlation coefficients of adjacent pixels for a given plain image are close to unity in all directions. A good encryption algorithm should produce a cipher image with correlation coefficients of adjacent pixels close to zero in all directions. To evaluate the correlation coefficients\(C_{mn} \) in this work, the following formula is exploited:

$$\begin{aligned} C_{mn} =\frac{\sum \nolimits _{x=1}^A {\left( {m_{x} -\bar{{m}}} \right) } \left( {n_{x} -\bar{{n}}} \right) }{\sqrt{\sum \nolimits _{x=1}^A {\left( {m_{x} -\bar{{m}}} \right) ^{2}\sum \nolimits _{x=1}^A {\left( {n_{x} -\bar{{n}}} \right) ^{2}} } } } \end{aligned}$$
(35)

Here, \(m_{x} \), \(n_{x} \) refers to the values of adjacent pixels and A refers to the whole amount of nearby pixel pairs. The distribution of correlation coefficients \(C_{mn} \) for red (R) components is plotted in Fig. 18. The adjacent pixels are linearly related in the horizontal, vertical, and diagonal directions for plain components, showing high correlation between adjacent pixels. Whereas random distributions are observed in the case of corresponding ciphers, indicating that no correlation exists between adjacent pixels. The same results have been observed in the green (G) and blue (B) components. Consequently, the proposed algorithm is able to resist attacks based on histogram analysis.

Fig. 18
figure 18

Correlation of plain red (R) component of Image 2 and the corresponding cipher in horizontal, vertical and diagonal directions

6.3.4 Information entropy

Information entropy is usually applied to investigate the level of randomness in an image [83, 84]. The global entropy of a given image Y is computed as:

$$\begin{aligned} E(Y)=-\sum \limits _{a=1}^{2^{b}-1} {p(y_{a} } )\log _{2} \left( {p(y_{a} )} \right) \end{aligned}$$
(36)

\(p(y_{a} )\) is the probability of \(y_{a} \) and b refers the pixel bit level. Local entropy provides more sensitive values of the entropy as the pixels are considered individually. It is well known that a good encryption algorithm should produce ciphers with entropy values near 8 for 8-bit images. Table 5 presents the results of the global and local entropy values of the considered test images and the corresponding cipher. From these results, it is obvious that the proposed algorithm is robust to attacks based on entropy analysis.

Table 5 Results of global and local information entropy

6.3.5 NPCR and UACI

The encryption algorithm can also be evaluated by using NPCR (Number of Pixels Change Rate) and the UACI (Unified Average Changing Intensity) computed respectively by [85, 86]:

$$\begin{aligned} \text {NPCR}= & {} \frac{\sum \nolimits _{i;j} {E(i,j)} }{r\times s}\times 100\% ,{\, \, \, }\nonumber \\ E(i,j)= & {} \left\{ {{\begin{array}{*{20}c} {0\,\,\,\,\,\,\,if\,\,\,\,\,\,P(i,j)=C(i,j)} \\ {1\,\,\,\,\,\,\,if\,\,\,\,\,\,P(i,j)\ne C(i,j)} \\ \end{array} }} \right. \end{aligned}$$
(37)
$$\begin{aligned} \text {UACI}= & {} \frac{100}{r\times s}\sum \limits _1^r {\sum \limits _1^s {\frac{\left| {P\left( {i,j} \right) -C\left( {i,j} \right) } \right| }{255}} } \end{aligned}$$
(38)

Where P and C are two encrypted data achieved from encrypted data different in just on pixel. r and s are the size of the data image. For 8-bit images the threshold values of NPCR and UACI are defined given by:

$$\begin{aligned} NPCR_{\max }= & {} \left( {1-2^{8}} \right) \times 100=99.609375\% \end{aligned}$$
(39)
$$\begin{aligned} { UACI}_{\max }= & {} \frac{\sum \nolimits _{j=1}^{2^{8}-1} {j(j+1)} }{2^{8}\left( {2^{8}-1} \right) }\times 100=33.46354\%\quad \end{aligned}$$
(40)

Table 6 provides the results of NPCR and UACI for four test images. It is obvious that the proposed algorithm can resist any differential attack given the presented values are above the threshold values.

Table 6 UACI and NPCR values of test images
Table 7 Comparative analysis of the proposed method with some recent literature shows the superiority of our method

6.3.6 Key space analysis

The key space of an encryption/decryption scheme is the set of different keys that can be exploited to encrypt and decrypt the information [87]. In order to resist brute force attacks a well-designed algorithm is required to have a very large key space. The threshold value is \(2^{100}\approx 10^{30}\). In this work the considered chaotic oscillator can be rewritten as:

$$\begin{aligned} \left\{ {\begin{array}{l} \dot{{x}}_{1} =-x_{1} -a{\, }tanh(\beta _{1} x_{1} )+b{\, }tanh(\beta _{2} x_{2} )+I_{m} sin(2\pi F\tau ) \\ \dot{{x}}_{2} =-x_{2} -k{\, }tanh(\beta _{1} x_{1} )+c{\, }tanh(\beta _{2} x_{2} ) \\ \end{array}} \right. \nonumber \\ \end{aligned}$$
(41)

where the parameters and initial states \(\beta _{1} ,\beta _{2} ,I_{m},k,a,b,c,\tilde{{x}}_{1} ,\tilde{{x}}_{2} \) are the main keys of the algorithm. If we consider \(10^{16}\) as the precision of calculations the total key space of the proposed scheme is computed as \(10^{16\times 9}=10^{144}>10^{30}\) consequently the proposed scheme is resistive to any form of brute force attacks.

6.3.7 Complexity and comparative analyses

One of the most important metrics for analyzing an algorithm is to assess its complexity [87]. Some current metrics of this evaluation include the running time (t) or the Encryption Throughput (ET) and the Number of Cycles (NC). The encryption time (t) is computed using the “tic-toc” MATLAB function, while ET and NC are computed as:

$$\begin{aligned} ET= & {} \frac{\text {Size}\,\text {of}\,\text {the}\,\text {image}\,(\text {Byte})}{\text {Encryption}\,time\,(\sec )} \end{aligned}$$
(42)
$$\begin{aligned} NC= & {} \frac{\text {CPU}\,\text {speed}\,(\text {Hz})}{ET(\text {Byte}/\sec )} \end{aligned}$$
(43)

A well-designed algorithm is required to consume less encryption time, less NC, and high ET to ease the implementation. The results of the computations are summarized in Table 7 using test images of size 256*256*3. The working environment is characterized by a 2.4GHz processor, Intel ®core TM i7-3630QM, 16 GB of RAM, and MATLAB R2016b software. It is also important to report the comparative analysis of the proposed methods with some recent literature. The comparison tools include but are not limited to complexity in terms of encryption and decryption time, NPCR, UACI, entropy, and key sequence. This comparative analysis shows that the proposed cryptosystem has high-security issues and is competitive with the fastest chaos-based cryptosystems. This is mainly due to pseudorandom sequences based on the dynamics of an adjustable gradient HNN and the utilization of lightweight techniques like DWT to sparse our input images.

7 Conclusion

A novel compressive sensing image encryption scheme using the dynamics of adjustable gradients HNN was considered in this paper. Firstly, the effects of the activation gradients of neurons are explored. The graphical representation of the solutions showed the influence of first and second neuron activation gradients with respect values. The analysis of the stability reveals that it depends on initial conditions that are associated with the values of activation gradients. Using nonlinear dynamics analysis tools with MATLAB, rich and varied dynamics that depend on the activation gradient of the first neuron have been highlighted. Phenomena showing the complexity of the model, such as the coexistence of two twin attractors, are exhibited, and the representations of the different basins of attraction have shown that they are all self-excited. For engineering applications, it is implemented in PSpice and yields results similar to those obtained from the numerical approach [39, 66,67,68,69, 91, 92]. From all of this, it is clear that an imbalance of neuron gradients that would lead to electrical activity in an HNN network would increase its complexity, give rise to interesting and different behaviors from those known. Finally, the sequences of the chaotic system are applied to design a strong measurement matrix for compressive sensing-based image encryption. In the same line, the sequences are employed in the confusion and diffusion steps. Security analyses indicated a good encryption algorithm.