1. Introduction
Privacy in visual communication is an important element of digital communications. Critical applications of digital images are being used in telemedicine, remote sensing applications, and IoT techniques in the cloud, where security and privacy of information are crucial [
1]. Hence, designing efficient encryption techniques to secure massive image data against illegal access and techniques of cryptanalysis are extremely important for cybersecurity [
2]. Additional block ciphers (such as AES) working with text are very popular but have been shown to be computationally inefficient for large, highly redundant data, like digital images [
3,
4]. However, chaos-based cryptosystems have gained popularity because of their inherent attributes: sensitivity to initial conditions, ergodicity, and pseudorandomness [
5]. Recent research has moved towards integer-order chaotic systems and to fractional-order calculus, which introduces the effect of memory and makes attractors more complex, thus increasing the key space and making it harder to linear-reconstruct attacks [
6,
7].
While many advances are made with high-dimensional chaotic ciphers, one security flaw is introduced: that of a fixed keystream generator. Most conventional chaotic ciphers use keys that are not related to the plaintext and are, therefore, susceptible to known-plaintext attacks (KPA) and differential cryptanalysis [
8]. Moreover, standard linear operations, such as bitwise XOR, although computationally efficient, are not non-linear enough to obscure statistical dependencies to the extent necessary between neighboring pixels in a real-world, dynamic traffic or remote sensing setting [
9].
Despite several papers proposing chaotic encryption algorithms, there is an apparent research gap in developing adaptive frameworks that inherently tie the chaotic trajectory to the image’s content. The current literature tends to decouple the engine and the kernel, without exploiting the possibility of plaintext-dependent feedback to dynamically evolve the chaotic attractor. Although current feedback systems have demonstrated some effectiveness in enhancing diffusion, no detailed models have been developed that account for rhythmic and harmonic complexity, similar to musical structure, in the chaotic state evolution to prevent pattern emergence.
To fill these gaps, this paper proposes a new piano-inspired memristive fractional-order cryptosystem. Its main goal is to develop a hybrid cryptographic system in which non-linear arithmetic kernels are balanced and correlated with a plaintext-dependent adaptive chaotic engine. The objectives of the research are threefold:
Create a 4D memristive fractional-order chaotic engine with high Lyapunov numbers and non-intersecting chaotic trajectories.
Implement a “Piano-Inspired” adaptive feedback system that inseparably connects the keystream generation to the processed image content and is resistant to differential attacks.
Measure the system’s performance using rigorous statistical metrics, such as NIST SP 800-22 randomness testing, entropy testing, and resilience testing against state-of-the-art cryptosystems.
The rest of this paper is structured as follows.
Section 2 discusses previous studies of chaos-based image encryption, fractional-order systems, and memristive chaos.
Section 3 presents the proposed cryptosystem, which includes the mathematical model of the chaotic engine, adaptive keystream generator, encryption, and decryption (with algorithms and numerical examples).
Section 4 discusses the experimental results on visual security, histogram, correlation, entropy, differential attack, GLCM, NIST tests, key sensitivity, CPA/KPA, encryption speed, image reconstruction quality, and chaotic dynamics.
Section 5 gives the conclusions and directions for future work.
3. Materials and Methods
The suggested cryptosystem architecture is based on a two-layer design, a dynamic chaotic engine with a fractional-order memristive behavior, and a non-linear cryptographic engine, as illustrated in
Figure 1. In the pre-processing step, the input color image is flattened into a single 1D stream of RGB channels, which guarantees that all the color texture components are retained. The resulting “encrypted” image is then sent over an insecure public channel, ensuring high-level protection against unauthorized use of the channel.
3.1. Mathematical Model of the Chaotic Engine
It is based on the complex, non-linear dynamics of a four-dimensional (4D) memristive chaotic system, developed in the context of the fractional-order calculus, which provides the cryptographic strength of the proposed system. The transition to integer-order dynamics in a system with multiple degrees of freedom and memory-dependent features provided by the use of the fractional-order calculus makes the chaotic attractors much more complex [
20]. The chaotic engine has the following system of fractional-order differential equations that form its governing equations [
21]:
where
is the Caputo fractional derivative of order
, and
is the state vector. The system parameters are set to
a = 10.0,
b = 8/3,
c = 28.0,
d = 1.0, and
ρ = 0.5. These particular values are mathematically supported by a continuous phase-space analysis to guarantee that the system is operating within a very dissipative phase zone. At this specific operational boundary, the continuous 4D memristive field gives rise to a stable chaotic strange attractor with a highly positive LLE value (1.7199), which is stable even with the change in the state of the field across the fractional derivative order domain
α ∈ (0, 1] [
22]. The Caputo fractional derivative is used because it is well-suited to physical modeling with well-defined initial conditions and is defined as:
where
represents the Gamma function [
23].
To model the non-linear dynamics of this system, we use the Adams–Bashforth–Moulton (ABM) predictor–corrector numerical system [
24]. It is selected for its superior numerical stability and convergence properties for fractional-order differential equations. The system is solved with a constant time step of 0.01, such that the trajectory stays within the strange attractor but remains very sensitive to changes in initial conditions and the fractional-order of the parameter,
.
To ensure that the four-dimensional (4D) memristive engine is in a chaotic regime, as required for cryptographic use, we performed three analyses: reconstruction of the phase portrait, bifurcation diagrams, and calculation of the largest Lyapunov exponent (LLE). The projections into the
x-y plane (left) and into the
x-w plane (right) are shown in
Figure 2. The attractor is a double-scroll structure similar to the Lorenz attractor, albeit with more folding because of the extra state variable
w; the
x-w plane projection is an asymmetric loop, which is the memristive coupling. The trajectory is not self-intersecting and is bounded, which demonstrates dissipative chaos.
Figure 3 shows the graph of the state
x versus
c for 20 ≤
c ≤ 40. This diagram illustrates the classic period-doubling route to chaos: a fixed point at
c shows <24.5; a sequence of period doublings around
c ≈ 24.7; and then fully established chaos at
c ≳ 28. The nominal operating point
c = 28 is well into the chaotic regime, and periodic windows (e.g., at
c ≈ 34.2) are quite short, suggesting complex dynamics. We obtained
LLE = 1.719890 using the Wolf algorithm with reorthogonalization (10,000 steps, dropping the first 2000 as transients). This positive value is sensitive to initial conditions; a value > 1 means it diverges faster, and even a small perturbation, such as
, can yield an entirely different set of keystreams within just a few steps. These findings, when combined, strongly confirm that the chaotic engine is a high-entropy source capable of generating cryptographic key streams.
3.2. Adaptive Keystream Generation
The new keystream generation scheme proposed is called the piano-inspired scheme and is based on a harmonic-like progression to provide plaintext-dependent security. Although feedback mechanisms have been identified in the literature as viable techniques to mitigate the avalanche effect in image encryption, the use of a harmonic and piano-like sequence logic is a novelty in this study.
The term “piano-inspired keystream generation” can be formally expressed mathematically as a stateful, pseudo-periodic progression of harmonic trajectories. This framework is different from typical image ciphers that use decoupled random sequence keys. This framework is different from the typical image ciphers, which use decoupled random sequence keys. The updating logic is scaled dynamically by means of a transient feedback equation that performs a pseudo-frequency shift for the structure and mimics this effect in terms of spatial pixel correlation. The feedback architecture allows the system to generate a vector field that at each successive state transition non-linearly diverges to remove any clustering of spatial patterns from the system.
In contrast to regular generators, which use fixed chaotic sequences, our engine dynamically adapts the chaotic trajectory based on the processed plaintext. This adaptive method manages to make sure each encrypted pixel affects the next chaotic value so that it kills the patterns, in addition to offering a high degree of resistance to differential cryptanalysis, a known weakness with the current cryptosystems in images.
Our proposed feedback equation is the logic of adaptation that ensures the sensitivity of the chaotic system:
For the sake of mathematical clarity and unambiguity about the content-dependent adaptation tracking of Equation (3), the following notations for the variables and dimensions of the vector spaces are defined explicitly. The variable is just a 4-dimensional (4D) continuous chaotic state column vector, . The adaptive perturbation parameter is a normalized scalar sequence, which is obtained by dividing the previous plaintext (or ciphertext) pixel value (or during chaining processing cycles) by 255.0, so that its value is within the unified numeric range .
This scalar adjustment is made only to the fourth component of the state vector (), which is the continuous flux variable regulating the internal dynamics of the memristive engine, in order to maintain the essential characteristics of the chaotic field parameters and also to ensure strong global diffusion. The non-linear multiplication terms of the governing differential Equation (1) are highly coupled, and if this plaintext-dependent scalar perturbation is introduced only at the coordinate w, an immediate transformation of the whole vector field results. This dynamic mapping ensures that the pixel-level values of and are immediately pushed apart in the next iteration of the mapping step, making spatial key tracking impossible and eliminating the repetition of an image’s spatial pattern within homogeneous matrices of image pixels.
The sensitivity scaling factor β = 0.05 is an optimized operational threshold, which is obtained through strict sensitivity experiments. The above-mentioned mathematical divergence is shown through a numerical analysis where it is found that for β > 0.1, the mathematical divergence of the plaintext is exponential, driving the fractional-order solver into unbounded numerical saturation. On the other hand, when β < 0.01, the influence of the network avalanche is not enough to resist differential cryptanalysis. The threshold value β = 0.05 provides optimum sensitivity to the plaintext and also keeps the system in the appropriate chaotic regime.
3.3. Encryption and Decryption Procedures
The appropriateness of the suggested cryptosystem is largely explained by its hybrid cryptographic core. Although conventional stream ciphers often use bitwise XOR operations to provide diffusion, these kinds of structures are vulnerable to known-plaintext attacks when the keystream is not complicated enough. Our suggested kernel avoids this by using a non-linear, reversible transformation that combines modular arithmetic with bitwise logic. This hybrid technique disrupts the linear relationship between plaintext and ciphertext, thereby increasing the system’s confusion and diffusion characteristics.
The exact structural forming of the input matrix needs to be specified to formally specify the data streaming pipeline and analyze the effect on pixel diffusion distributions in a systematic manner. The three-dimensional color image tensor () is transformed into a single common 1D interleaved RGB stream, in which all the R, G, and B elements are grouped together sequentially as (). The cryptosystem deliberately does not process the color matrices sequentially; that is, by isolating the whole red matrix and then the green matrix, since sequential structures mean that there is much propagation delay between the color boundaries.
The proposed plaintext-dependent feedback loop is implemented by a pixel-by-pixel interleaved stream configuration, which causes the continuous chaotic engine coordinates to change their trajectory across the color bounds at every iteration. A small change in one of the pixel components of the red channel causes the value of the memristive flux state variable w before processing the next green component to be perturbed, causing it to change at the pixel level and leading to a resulting ciphertext. This interleaved architecture allows for isotropic diffusion velocity over the totality of the multi-channel matrix at the same time; it completely eliminates the inter-channel data dependencies, and it pushes the diagonal, horizontal, and vertical correlation coefficients to near-zero statistical limits.
The transformation operates pixel by pixel, and the chaotic engine can produce two independent streams (
K1,
K2). The transformation of the encryption is:
In which
is the plaintext pixel,
is the ciphertext pixel, and
is the bitwise XOR operation. The mathematical formulation consists of a pair of layered transformations: modular arithmetic introduces a non-linear carry propagation, and bitwise XOR introduces a fast bit-level permutation. The following decryption transformation ensures reversibility of the system:
The exact procedures for encryption and decryption are formalized in Algorithm 1 and Algorithm 2, respectively.
| Algorithm 1: Encryption Procedure |
| Input: Original Image , Initial State , Chaotic Parameters . |
| Output: Ciphertext Image . |
| Initialize Chaotic Engine with and . |
| Pre-process into a 1D vector of length . |
| For to do: |
| Compute chaotic keystream bytes using the 4D engine (refer to Section 3.2). |
| Perform modular addition: . |
| Perform bitwise combination: . |
| Update chaotic state: Equation (3). |
| Reshape to the original dimensions . |
| Return . |
| Algorithm 2: Decryption Procedure |
| Input: Ciphertext Image , Initial State , Chaotic Parameters . |
| Output: Restored Image . |
| Initialize Chaotic Engine with and . |
| For to do: |
| Regenerate chaotic keystream bytes (must be identical to encryption). |
| Undo bitwise operation: . |
| Undo modular arithmetic: ) mod 256. |
| Feedback Update: Update chaotic state using as the input perturbation. |
| Reshape to the original dimensions . |
| Return . |
The hybrid non-XOR cryptographic kernel completely defeats advanced algebraic attacks that rely on exploiting linear mathematical modular properties. Modular addition () and bitwise exclusive-OR () cause non-linear propagation of carry bits across the structural boundaries. The keystream coordinates change for each processed pixel since the operational pipeline is a stateful stream engine . This is a dynamic architecture that makes linear and differential algebraic reconstruction mathematically intractable because of the absence of static tracking. The design principles of the layout are based on high-performance, multi-image significance-aware ciphers with high non-linear parameter spaces to ensure absolute diffusion barriers against the exposure of the plain image.
Figure 4 shows the whole encryption pipeline for one pixel, giving a clear numerical trace. There are four areas for the operation. Zone 1 shows how the chaotic state has changed: the new state
is made by adding the fractional order contribution
and an adaptive feedback term
β⋅C
i−1/255 (with
β = 0.05) to the previous state
. Zone 2 takes two bytes from the updated state and turns them into a keystream:
K1= ⌊|w|·106⌋ mod 256 = 3 (using the w component) and
K2 = ⌊|z|·106⌋ mod 256 = 21 (using the
z component). The hybrid encryption kernel is used in Zone 3. First, the plaintext
Pi = 125 is added to
K1 modulo 256, which gives the intermediate value 128. Then,
K2 is XORed with this value to get the ciphertext
Ci = 149. Finally, Zone 4 sends the ciphertext back as the new “previous” value for the next pixel. This adaptive feedback loop makes sure that the keystream is based on data that has already been encrypted, which greatly improves diffusion and makes it harder to use differential cryptanalysis.
The feedback loop strictly keeps encryption and decryption in sync, as explained in these procedures. The system uses the ciphertext as the source of noise for the chaotic engine in both Algorithm 1 and Algorithm 2. This keeps the trajectory perfectly in sync for both parties while preventing unauthorized observers from determining the initial parameters.
4. Experimental Results
Numerous numerical simulations were carried out to systematically assess the performance, efficiency, and cryptographic robustness of the proposed cryptosystem. All cryptographic-processing loops and performance benchmarks were carried out on a standard computing environment made up of a MacBook Pro (Apple Inc., Cupertino, CA, USA) workstation with 8 GB of unified configuration system memory and an Apple M1 system-on-chip (CPU 8 cores, base clock speed 3.2 GHz). This security pipeline has been created and implemented in a pure Python environment (Version 3.10.12) on macOS. The optimized vector functions of the NumPy framework (v1.24) were used to handle advanced multidimensional array indexing and matrix manipulations, while digital image spatial parsing and I/O tasks were handled through standard OpenCV-Python (v4.7) bindings. Advanced validation of secondary sculptural textural features was performed using the scikit-image framework. More importantly, the main Adams–Bashforth–Moulton engine solver loop was wrapped with Numba Just-In-Time (JIT) machine-level compilation flags (@jit(nopython = True)) to circumvent the typical Python execution latency witnessed by interpreted loop cycles in solving continuous high-dimensional fractional differential calculus. The mathematical loops can be compiled into very efficient multi-threaded native machine code at runtime so that the same native speeds are achieved across the ARM64 architecture regardless of whether the loops are executed on low-level graphics hardware (GPU) at runtime. The validation dataset used for testing the system came from two well-known and open academic datasets, namely, the USC-SIPI Image Database [
25] and the University of Konstanz Dataset [
26]. The test set consists of six standard RGB color images with varying structural textures, Baboon.png, Cat.png, Fruits.png, Monarch.png, Frymire.png, and Pool.png, each with a uniform spatial resolution of 256 × 256 × 3 pixels. The test images were carefully chosen to be representative of the typical, highly redundant visual profiles that are universally known and considered benchmarks in the image cryptography literature. In all the experimental tests, the basic operational conditions of the fractional-order memristive chaotic engine were fixed as the fractional derivative order
, time step boundary
, and sensitivity scaling factor
. The boundary condition for the chaotic engine was set at a master continuous initial state vector
to give a stable chaotic engine boundary condition for all processing iterations.
4.1. Visual Security Analysis
The main purpose of any image encryption algorithm is to transform the original plaintext image into an unrecognizable noise-like ciphertext and ensure that it can be perfectly restored at the decryption end. In this subsection, we assess the visual quality of the encrypted images that are generated by the proposed cryptosystem and verify the integrity of the decryption process. There are three rows of images (see
Figure 5) illustrating a representative test image, which is known to have rich textures and fine details. The original plaintext image is shown in the first column. The second column gives the ciphertext resulting from the encryption process described in Algorithm 1. It is clear that the ciphertext is a completely disordered, random pattern with no edges, structures, or color correlations. There are no visual cues of the original. This demonstrates that the hybrid kernel (modular addition and XOR) along with adaptive chaotic chaining is able to mask all perceptual clues.
Figure 5 displays the decrypted image of Algorithm 2 in the third column. The decrypted image has the same visual appearance as the plaintext. The pixel-by-bit comparison shows that the restoration is lossless: the mean squared error (MSE) between the original and the restored image is zero, and the maximum signal-to-noise ratio (PSNR) is infinity (or greater than 100 dB). To be complete, the PSNR of the plaintext and the ciphertext is 8.94 dB, similar to the noise pattern of a random variable, which shows that the ciphertext has absolutely nothing in common with the plaintext.
4.2. Histogram Analysis
A histogram of an image is a count of how many times each pixel intensity level (0–255) occurs. Histograms in natural images tend to be non-uniform because they reflect the true visual object [
27]. The optimal image cipher should have a flat histogram of ciphertext. The histograms in
Figure 6 of the three color channels (red, green, blue) of the plaintext image Pool.png (top) and the resulting ciphertext (bottom) demonstrate the difference between the plaintext and ciphertext. Histogram patterns of plaintexts are characteristic of natural images and directly provide structural information about the content.
In stark contrast, the ciphertext histograms (bottom of
Figure 4) are nearly completely flat throughout the entire intensity range. The frequency distribution of the 256 intensity levels is approximately equal across all channels. Considering that the test image has 256 × 256 pixels, 65,536 pixels make up each channel. The optimum frequency would then be 65,536/256 = 256. The frequencies of the ciphertext histograms are extremely near this ideal, and there are only slight random variations, which, being expected at a finite sample size, are statistically insignificant. All six test images (
Baboon,
Cat,
Fruits,
Monarch,
Frymire,
and Pool) exhibited the same uniform behavior. Therefore, the cryptosystem in question does a good job of removing any statistical trace of the plaintext, rendering the histogram-based attacks impossible altogether.
4.3. Correlation Analysis
The neighboring pixels in a natural image exhibit strong correlation. This statistical redundancy arises from the continuous changes in color and intensity across most of a photograph, applied smoothly [
28]. A good image cipher should be able to randomize these correlations, or an attacker can use the rest of the linear dependencies to reconstruct the plaintext based on the ciphertext [
29]. To measure this property, we calculate the correlation coefficient
of pairs of neighboring pixels in the horizontal, vertical, and diagonal directions. Given two vectors x and y of the intensities of pairs of pixels,
is defined as:
where
n is the number of pairs of pixels, and
,
are the sample means. A large value of
means that the two variables are linearly correlated, whereas a value of
that is near 0 means that the two variables are not linearly dependent.
Table 1 shows the mean of the correlation coefficients of the plaintext and ciphertext across the six test images in the three directions.
The plaintext images are highly correlated in all three directions (horizontal: 0.848283; vertical: 0.795001; diagonal: 0.754527). This should hold for natural images. Once the coefficients have been encrypted, they become very low: horizontal 0.001369, vertical −0.001244, and diagonal 0.006576. The coefficients are all very small, less than 0.01, which proves that the encryption does not leave any linear dependence between two neighboring pixels. The 3D scatter plots in
Figure 7 give visual confirmation. The intensity of a pixel on the x-axis and the intensity of its neighbor on the y-axis are displayed on all three color channels (blue, green, and red). In the original plaintext (
Figure 5a), there is a high concentration of points along the main diagonal and a thin cloud around the line y = x. This form implies that a pixel value is a strong predictor of the value of its neighbor—an obvious indication of high correlation. By contrast, the ciphertext scatter plot (
Figure 7b) shows an entirely diffuse distribution: the points are evenly distributed across the square [0, 255] × [0, 255] with no discernible direction or concentration. The encryption destroys all spatial dependencies, as the three color channels randomly overlap. The extremely small correlation coefficients and the diffuse 3D scatter plots together confirm that the given cryptosystem indeed removes statistical linear redundancy. The property is necessary to withstand correlation-based attacks, and it is a good sign of high cryptographic quality.
4.4. Information Entropy
The uncertainty or randomness of a data source is quantified by information entropy, introduced by Shannon [
30]. In the case of an image, it measures the degree of unpredictability of the pixel intensities. In any 8-bit grayscale image (0–255), the maximum entropy is 8 bits per pixel, and this is only attained when there is an equal distribution of 256 intensity levels. Entropy
of an image can be defined as:
is the probability of occurrence of the intensity value
. A ciphertext that has entropy near the theoretical maximum of 8 is thought to be very random and difficult to attack statistically.
We computed the entropy of encrypted images of all six test images (
Baboon,
Cat,
Fruits,
Monarch,
Frymire,
and Pool) at three different resolutions: 128 × 128, 256 × 256, and 512 × 512 pixels. The results are detailed in
Table 2.
Even the tiniest resolution (128 × 128) has very high entropy values (about 7.996), which are almost equal to the ideal eight. The closer the entropy is to the theoretical maximum, the larger the image size. At 256 × 256, the average entropy over the six images is 7.9994, and at 512 × 512, it reaches 7.9998. These values are virtually identical to the ideal uniformity.
The small deviations of eight are attributed to finite-size statistical fluctuations and are not an exploitable bias. The entropy of the original plaintext images, in contrast, is typically approximately 7.4 due to the inherent redundancy of photographic information. This wide range of 7.9993–7.9998 shows that the proposed cryptosystem offers an efficient mechanism of randomization of image pixels, and the ciphertext obtained is statistically similar to that obtained from a random source.
As a result, the information entropy results show that the given encryption scheme meets the strict randomness criterion for a secure image cipher. The entropy of the ciphertext cannot provide any statistical information about the plaintext to an attacker.
4.5. Differential Attack Analysis (NPCR and UACI)
Differential cryptanalysis is a strong attack that involves a differential analysis of the propagation of small changes in the plaintext (changing a single pixel) through the cipher. In the case of image encryption, the attacker can change one pixel of the plaintext and see how the ciphertext changes [
31]. If the difference between the modified ciphertext and the original ciphertext is small, then the attacker can potentially find a link between the plaintext and the ciphertext, and then find the key or the plaintext.
The two most common measures of resistance of an image cipher to differential attacks are the Number of Pixel Change Rate (NPCR) and the Unified Average Changing Intensity (UACI) [
32]. They are defined as follows.
Let
and
be a pair of plaintext images differing by just one pixel, and let
and
be the corresponding ciphertext images of size
with values in [0, 255]. Let
be a binary matrix given by:
Table 3 shows the results. All values shown here are averaged over the six test images (
Baboon,
Cat,
Fruits,
Monarch,
Frymire,
and Pool) and a 256 × 256 resolution.
The value of all the single-pixel NPCR is high (above 99.6) and well above 99.5 percent. The UACI values range from 33.34 to 33.49, and all are very close to the ideal 33.33. The NPCR and UACI for the black vs white test are 99.60% and 33.40%, respectively, which are both excellent.
Figure 8 visualizes the chosen-plaintext (CPA) and known-plaintext (KPA) simulations. The all-white and all-black input images are displayed in subfigures (a) and (b), respectively. Subfigures (c) and (d) demonstrate unsuccessful decryption when the wrong key (or even a small perturbation of the correct key) is applied. The result is totally random, which substantiates the high sensitivity of the key (see also
Section 4.8).
These findings indicate that the suggested cryptosystem has a perfect avalanche effect and is extremely resistant to differential, chosen-plaintext, and known-plaintext attacks.
Apart from this, the adaptability of the proposed framework in physical communication channels should be carefully examined with regard to the error propagation properties and the synchronization limits with real network constraints. As the plaintext-dependent chaining mechanism being used by the cryptosystem dynamically modifies the continuous 4D memristive vector field , the decryption pipeline is a highly sensitive stateful machine. Therefore, any error in the transmission of a single bit or distortion of a few pixels in the channel will lead to complete dis-synchronization of the fractional-order Adams–Bashforth–Moulton solver at the receiver.
In real networks, if some packets are lost or transmitted incompletely, then everything below the lost packet will be corrupted. This extreme avalanche sensitivity is a cryptographic blessing from the perspective of an adversary since it ensures that chosen-ciphertext tampering, frame substitution, and malicious packet injection attacks are perfectly resisted. But to deploy this raw cipher architecture safely over lossy or noisy networks, the communication stack needs to be coupled with the standard network-layer robustness techniques, too. Forward Error Correction (FEC) block codes or Automatic Repeat Request (ARQ) retransmission layers that make sure the received bitstream is completely error-corrected and verified before the continuous fractional chaotic decryption solvers are executed ensure that images are completely recovered without loss, guaranteeing image recovery with zero losses.
4.6. Gray-Level Co-Occurrence Matrix (GLCM) Analysis
The second-order statistical method is the Gray-Level Co-occurrence Matrix (GLCM) that describes the spatial correlation between pairs of pixels at a displacement and an orientation [
33]. In contrast to first-order statistics (e.g., histogram), the GLCM measures textural features including uniformity, contrast, and regularity. In the case of an encrypted image, an ideal cipher must generate a texture that is entirely random, i.e., it has no repeating patterns, no predominant orientations, and no homogeneous areas [
34].
The GLCM of the ciphertext images with a displacement of one pixel at angles of 0°, 45°, 90°, and 135° was computed. Three typical measures were obtained:
Homogeneity (also referred to as Inverse Difference Moment) indicates the local smoothness of the image. A large homogeneity denotes similar pixel values, and a small homogeneity denotes a sudden change. In the case of random noise, the homogeneity will be close to 0.
where
is the likelihood of two pixels with intensities
and
appearing at the given displacement and angle.
The results of each of the six test images (256 × 256) at each of the four angles, along with directional averages, are shown in
Table 4.
The homogeneity ranges from 0.0166 to 0.0177 across all images and directions. These values are close to zero, which means that neighboring pixel pairs are hardly ever similar, a characteristic of random noise. The small change in direction (e.g., 0.01661–0.01773 Baboon) ensures that the texture is essentially isotropic.
Contrast is extremely high, with a range of 4800 to 4900. The contrast range of all images is still typical of a completely random distribution of intensities (the maximum theoretical contrast of a 256 × 256 random image is approximately 6500, so values in the range of 4800–4900 are outstanding).
Energy is so low and so constant that the difference between 0.00612 and 0.00614 occurs in all the images and in all directions. This implies that no specific intensity pair dominates the co-occurrence matrix; the distribution is nearly equal. Iso-directionality is again confirmed by the near-perfect direction independence.
The homogeneity, contrast, and low energy across all six test images are consistent, indicating that the proposed cryptosystem generates ciphertext with a completely random, texture-less appearance. The lack of directional bias (the values of all four angles are nearly equal) indicates that the encryption is isotropic, i.e., it does not favor any particular spatial orientation. This is a crucial property to withstand texture-based statistical attacks.
4.7. NIST SP 800-22 Statistical Tests
The National Institute of Standards and Technology (NIST) offers a large set of statistical tests to determine the randomness of binary sequences [
35,
36]. The condition of passing these tests is that the cryptographically secure pseudorandom generator, or the ciphertext bitstream in the case of image encryption, must pass.
The complete set of NIST SP 800-22 statistical tests was run on the encrypted bitstream to thoroughly analyze its statistical randomness and to verify that the proposed piano-inspired cryptosystem is a high-entropy cipher. In order to avoid layout bias and to obtain inter-channel dependencies, the three-dimensional encrypted image matrix was flattened to a continuous 1D interleaved binary stream (
). This was done as a pre-processing step, resulting in a continuous sequence of length
N = 6,291,456 bits, and it was analyzed using standard continuous blocks of 1,000,000 bits. The level of significance was set at
, and
p-values ≥ 0.01 were considered successful passes. All 15 core NIST tests and the individual
p-values and success proportions are reported in
Table 5. The experimental results demonstrate that the generated ciphertext stream satisfies all 15 cryptographic randomness requirements, and thus it is computationally indistinguishable from an ideal random bitstream.
The p-values are greater than the significance level of 0.01. The serial test is a perfect p-value of 1.0000, which is a good marker that the frequencies of overlapping patterns are just as they would be in a real random sequence. The Cumulative Sums test has a p-value of 0.0278, which is not below 0.01. The smallest p-value (frequency = 0.065) is already over six times the threshold, and there is no doubt that it is random. These findings indicate that the ciphertext generated by the proposed cryptosystem passes the 15 NIST tests. Thus, the output bitstream is statistically identical to a truly random sequence, an essential criterion for a secure image encryption algorithm.
4.8. Key Sensitivity Analysis
The encryption key should also be very sensitive in any secure cryptosystem; even a slight modification to this key should result in a totally different ciphertext. This feature, called the avalanche effect, prevents an attacker from predicting the key or exploiting near-key associations. In the proposed system, the fractional order α and the initial state vector are the secret keys. We tested key sensitivity by introducing a perturbation to a single key element while keeping all other factors constant and compared the resulting ciphertext with the original. Two tests were conducted:
In both cases, the original and the modified keys were used to encrypt the same plaintext image (256 × 256, an average of the six test images). The NPCR and UACI of the two ciphertexts were calculated.
Table 6 shows the results.
Both the NPCR values are over 99.5%, and both the UACI values are very near the ideal 33.33%. It follows that, at least with the key changed by a very small fraction (one part in ), the change in ciphertext at every pixel occurs in over 99.6 percent of the pixels, and the differences in intensities of the pixels are optimally spread.
The mathematical modeling of the continuous fractional-order memristive engine implies that there is a potentially infinite range of parameters, greater than
(
), for this device to be useful for cryptographic purposes, though the range of parameters needs to be tested under the finite quantization constraints imposed by the physical computing architecture. Continuous states are constrained by the finite machine precision feature of floating-point numbers, which has about 15 decimal digits of mantissa representation under the IEEE 754 [
37] double-precision floating-point standard.
Since we want to be as mathematically consistent as possible with our initialization environment and empirical key sensitivity testing, the effective computational keyspace needs to be directly derived from our key sensitivity threshold,
. For the five independent operational secret key parameters (the fractional integration derivative order α and the four continuous system coordinates
), the precision of
results in
distinct, non-overlapping cryptographic states per parameter. Thus, the number of keyspace
available to the system is the product space boundary computed as:
This efficient computational keyspace of is far larger than the threshold of that has been traditionally used for a computational keyspace to withstand exhaustive quantum era search algorithms. Even when machine precision bounds are considered, the effective entropy of the engine is very secure, even across insecure channels of public transmission.
To conclude, the encryption scheme suggested is highly sensitive to the key, meeting the most stringent conditions of cryptographic key use.
4.9. Chosen-Plaintext and Known-Plaintext Attacks (KPAs/CPAs)
The resistance of the proposed cryptosystem against chosen-plaintext attacks (CPAs) and known-plaintext attacks (KPAs) is formally analyzed in the context of a state–machine cryptographic framework and establishes a rigorous security basis that goes beyond empirical testing. The proposed system is structurally a security assumption of a Stateful Stream Cipher with Plaintext-Dependent Dynamic State Feedback (SDF-PDFB). Under this definition, the keystream bytes () are not static output bytes but rather are functions of a continually evolving 4D continuous vector field vector space, .
The key security architecture is based on a stateful feedback equation, which is a recursive mapping of the state transition during operation as follows:
where
is the state vector of the internal state at step
,
is the continuous fractional-order memristive vector field solver under integration order of α, and
is the normalized non-linear perturbation scalar directly mapped from the previous processed pixel.
These formal assumptions will eliminate the basic approach of linear and differential cryptanalysis from the cryptosystem. In the standard CPA, an attacker tries to process a set of homogeneous images, e.g., all-black or all-white matrices, in order to differentiate the keystream . Due to our architecture, however, an identical sequence of input pixels will lead to a dynamic change of the internal variables of the 4D engine at every step, even if we insert the same sequence. The trajectory of the keystream varies non-linearly for each and every keystream pixel in the image. This naturally makes the mapping of the secret master key to the resulting ciphertext very complicated and historical, and so any adversary attempting to build valid linear tracking equations, or a static equivalent keystream, will be mathematically unable to do so.
We modeled two extreme cases: an all-black (all pixels = 0) image and an all-white (all pixels = 255) image. The resulting two ciphertexts were compared, yielding NPCR of 99.60% and UACI of 33.40%—both within the desired range. This implies that the ciphertexts are entirely dissimilar, and no statistical relation can be derived. Resistance to differential chosen-plaintext attacks is already known to exist based on the single-pixel change test (
Section 4.5). Thus, the cryptosystem effectively overcomes KPA and CPA.
4.10. Encryption and Decryption Speed
The practical viability of a cryptosystem is determined by its security and computational efficiency. The encryption and decryption times of the proposed algorithm were measured using six test images at three resolutions: 128 × 128, 256 × 256, and 512 × 512 pixels. All the experiments were performed on a MacBook Pro using an Apple M1 processor and 8 GB of RAM. The ten independent runs in each image are the averages of their reported times. The results are summarized in
Table 7.
The bottleneck of high-dimensional fractional differential calculus solvers in Python is overcome by embedding the core execution loop with Numba Just-In-Time (JIT) acceleration layers of native machine instructions. This compiled code structure optimizes array slicing and loop execution and makes it possible to achieve linear execution time complexity , where is the total spatial pixel distribution. In the typical 256 × 256 imaging used in clinical archiving and automated telemetry, the stabilized latency profile provides an extremely acceptable security/performance trade-off in which content-adaptive protection is considered over the amount of raw transmission.
In the case of 256 × 256 resolution, the average encryption time is around 3.4 s (between 3.29 and 3.80 s), and the average decryption time is 2.75 s (between 2.58 and 3.00 s). Decryption is always faster than encryption, since it requires one fewer modular reduction per pixel (it does XOR and then subtraction, whereas encryption does addition and then XOR with an addition modulo at the end). The difference is greater with larger images.
Scaling behavior (time complexity) is where N is the number of pixels in the image (N = width × height × 3 color channels). Each pixel is processed just once in the encryption process. For each pixel, the chaotic state is updated (four ODE function calls, one exponentiation), and two arithmetic operations (modular addition and XOR) are carried out. The number of operations per pixel remains independent of N; hence, the overall time is expected to be proportional to N, i.e., O(N). This is supported by the measured times; tripling the linear dimension between 128 and 256 (a factor of 4 in pixel count) increases the encryption time by a factor of around 2.5–3.0, and between 256 and 512 (a factor of 4) increases the encryption time by a factor of around 3.0–3.5. The interpreter overhead and memory allocation of Python are the cause of the slight sub-linearity, although the complexity is practically linear.
In moderate-sized images (e.g., 256 × 256), as is common in many medical or remote sensing systems, 3–4 s is good, particularly where security is paramount. Implementation of the chaotic engine in a compiled language (C/C++), with vectorized instructions (SIMD), or offloaded to a GPU or FPGA, can reduce the encryption time. Its linear O(N) complexity ensures that the scheme is feasible with larger images should the need arise.
4.11. Quality Analysis (MSE, PSNR, and MAE)
The quality of an encrypted image is determined by comparing it with the original plaintext. In contrast to conventional image quality measures (where large similarity is sought), in encryption, we want to have high dissimilarity—the ciphertext should look like random noise and not have any perceptual or statistical similarity to the plaintext [
38]. Three metrics are employed [
39,
40]:
The peak signal-to-noise ratio (PSNR) is a value derived based on MSE, in decibels (dB). The smaller the PSNR, the greater the distortion. For good encryption, the PSNR should be low (usually less than 10 dB).
We calculated each of the six test images at 256 × 256 resolution with these metrics.
Table 8 shows the results.
4.12. Comparative Analysis with Recent State-of-the-Art Image Encryption Schemes
To investigate the performance of the proposed cryptosystem in a deeper way, it has been compared to a few recent state-of-the-art chaos-based image encryption schemes, which are presented in
Table 9. The proposed method has competitive entropy, NPCR, and UACI and has the advantages of adaptive ciphertext-dependent feedback and fractional-order memristive dynamics. The proposed cryptosystem shows a good trade-off between security performance, randomness, and computational complexity and can be used in secure image protection applications, especially in resource-limited scenarios.
Table 9 compares the proposed scheme with recent state-of-the-art chaos-based image encryption schemes.
5. Conclusions
In this work, an adaptive image cryptosystem was proposed, which integrates a fractional-order memristive chaotic engine with a non-linear hybrid encryption kernel synergistically. The system uses a piano-like feedback; the keystream generation is varied dynamically depending on the previous encrypted pixel, creating a robust CBC-like chaining. The chaotic engine is controlled by a four-dimensional memristive system, which is solved using fractional-order calculus, yielding a cryptosystem with an ultra-large key space (>1080) and extreme sensitivity to initial conditions, as evidenced by a positive largest Lyapunov exponent (1.7199) and a bifurcation diagram confirming the chaotic regime.
The encryption kernel is based on a reversible two-step transformation, where the plaintext is modularly added to the first keystream byte and then XORed with the second keystream byte, instead of the traditional bitwise XOR. The design is especially effective in increasing non-linearity and confusion and has perfect reversibility.
Extensive tests were done on six publicly available 256 × 256 color images using a typical MacBook Pro with an Apple M1 processor. The findings of the experiment prove:
Close to ideal information entropy (7.9994) and homogeneous histograms, which are a demonstration of statistical randomness.
Excellent differential attack resistance, with NPCR of 99.62 and UACI of 33.43, which are much higher than the 99.5% and almost equal to the 33.33% ideal values.
Correlation coefficients near zero (e.g., horizontal 0.0014), breaking any linear relationships between neighboring pixels.
GLCM homogeneity = very low (≈0.017), contrast = very high (≈4843), and energy = very low (≈0.0061), which shows a random, isotropic texture.
Passing seven NIST SP 800-22 statistical tests (p-values > 0.01).
Extreme key sensitivity: a difference as small as 1 × 10−14 in α or x0 alters over 99.6% of the ciphertext. This property involves full resistance to the chosen-plaintext and known-plaintext attacks, checked by all-black/all-white and single-pixel modification tests. A linear time complexity is O(N).
Encryption and decryption times of 3.40 s and 2.75 s, respectively, on average for 256 × 256 color images on the test platform.
The primary shortcoming is that the encryption speed is less than that of hardware-optimized ciphers, such as AES. However, the proposed cryptosystem can be applied in high-security applications (medical image protection, privacy-preserving multimedia transmission, and secure cloud storage) where the throughput is not the limiting factor.
For future work, we will implement the chaotic engine in a compiled language (C/C++), parallel instructions (SIMD), or GPUs and explore hardware versions of the system on FPGAs to achieve real-time speeds. Furthermore, we can extend the adaptive feedback to block processing and research hybrid schemes using a lightweight cipher to work on the speed–security trade-off. Although a direct comparison at the implementation level with AES-CBC and AES-CTR under the same experimental conditions is an important aspect, it is left for future work.