- Chinese Optics Letters
- Vol. 24, Issue 6, 060501 (2026)
Abstract
Keywords
1. Introduction
Information security has become a critical issue in modern society[1]. Optical cryptosystems, offering advantages of high security, high speed, and multidimensional capability, are considered highly promising solutions for information protection[2–8]. Among these, speckle-based optical encryption leverages random scattering media to achieve information scrambling. The inherent complexity and randomness of such media provide a high degree of security, making speckle encryption an important research direction in optical security[9–11].
In recent years, the integration of deep learning with scattering media has offered new insights into optical encryption and information processing[12–16]. These approaches typically employ scattering media such as frosted glass[13], random phase masks[17], or disordered metasurfaces[18] to transform plaintext into complex and random speckle fields[16–20]. By measuring the ciphertext intensity using detector, large scale plaintext-ciphertext pairs can be collected to serve as training datasets for neural network. Such methods do not require explicit knowledge of the optical transmission matrix. Instead, they rely on end-to-end training to optimize network weights and biases to learn the mapping between plaintext and ciphertext, thereby achieving speckle decryption. This has led to significant advances at the intersection of optical security and intelligent computation. Accordingly, acquiring sufficiently large training datasets to carefully train the network is crucial for these encryption systems.
Purely data-driven end-to-end decryption schemes may be limited by the availability of a sufficient number of real images for training. For example, speckle encryption schemes based on multimode fibers may require several days to acquire thousands of speckle samples[21], during which environmental perturbations, such as temperature fluctuations, vibrations, and fiber bending, can significantly alter the optical transmission matrix. It has been reported that bending of the optical fiber can render a trained network ineffective[22], making it impossible to acquire enough real images for training. Moreover, because neural networks lack inherent physical constraints, purely data-driven schemes often require complex architectures and large-scale datasets to converge over extended training periods[23–25]. Additionally, during ciphertext measurement, detectors capture only intensity information, while phase information is lost, resulting in incomplete network input representations. This necessitates even larger datasets (intensity-only images) and longer training times to compensate for missing information. Repeated measurements to generate large-scale datasets are time-consuming and require substantial storage, incurring high acquisition costs. Consequently, in many practical scenarios, collecting sufficient training data is challenging, leading to network overfitting and limited generalization and thereby constraining applicability.
Sign up for Chinese Optics Letters TOC. Get the latest issue of Chinese Optics Letters delivered right to you!Sign up now
In existing approaches, neural networks are usually employed for decryption[16–20], requiring measured ciphertexts to be processed via GPU-based inference. This introduces latency and significant power consumption, deviating from the original intention of all-optical encryption, leading to the loss of the merits of parallel, high-speed, and low-power consumption properties to some extent. To date, the concept of employing neural networks to directly perform optical encryption and to realize decryption by exploiting the amplitude and phase of the ciphertext field has not yet been explored. Current techniques, relying solely on limited intensity-only measurements and networks lacking physical mechanisms, struggle to capture the physical mapping between plaintext and ciphertext effectively. Therefore, developing a framework in which neural networks perform encryption and can exploit the complete complex amplitude of the optical field while circumventing the need for large-scale data collection is of critical importance.
Here, we introduce a novel physics-driven encryption diffractive deep neural network (Phys-Encrypt-Net). Departing from conventional network-based decryption approaches, our system employs a multilayer diffractive deep neural network (D2NN)[26–30] as a stacked scattering medium to physically encrypt plaintext optical fields into ciphertext. The phase distribution, pixel count, pixel pitch size, and interlayer distances collectively constitute a physical key, providing a high level of security. During decryption, a complete physical model is employed. This allows the amplitude and phase of the ciphertext to be decrypted directly using a fixed phase plate as the physical decoder, operating entirely in the optical domain without digital processing delay. Optimization is achieved through the interaction between the network and the physical model. This process yields a feasible solution that satisfies the imposed physical constraints and avoids the phase loss inherent to intensity-only detection. By incorporating explicit physical constraints and the network, this approach eliminates the need for ciphertext acquisition and subsequent GPU-based numerical decryption. At the same time, it substantially enhances generalization performance and physical interpretability. Phys-Encrypt-Net achieves 94.65% decryption accuracy on speckle fields generated from 10,000 previously unseen MNIST images. Even when sufficient training data are unavailable, the system can perform encryption and decryption at the speed of light, with low power consumption and high speed. This provides a new paradigm for physically interpretable optical information security systems that do not require large-scale ciphertext acquisition.
2. Methods
2.1. Structure of Phys-Encrypt-Net cryptosystem
The optical design of the speckle-based encryption system built on the Phys-Encrypt-Net framework is illustrated in Fig. 1. A 633-nm-laser beam is expanded and projected onto a digital micromirror device (DMD)[31,32] to form the plaintext optical field, where handwritten digits from the MNIST dataset are displayed. The resulting plaintext field passes through a system with a pinhole filter, serving as the input layer of the diffractive network. It then sequentially propagates through four diffractive layers, each consisting of neurons with a pixel pitch of 8 µm, before forming a speckle ciphertext field at the output plane. Through the multi-layer diffraction process, the plaintext information becomes highly scrambled. Unlike conventional approaches that rely solely on intensity measurements for neural network-based digital decryption, Phys-Encrypt-Net utilizes both the amplitude and phase of the ciphertext optical field during decryption. A phase plate is designed as the physical decoder, and after propagating a certain distance, the ciphertext field is modulated by this phase plate and recorded by a camera on the detection plane. The decrypted result appears as the energy distribution across ten predefined regions on the detector where the index of the region with the maximum intensity corresponds to the recognized digit. Importantly, our system does not require ciphertext measurement followed by numerical decryption on a GPU. Instead, the optical setup itself serves as a physical decoder, enabling fully optical speckle decryption by exploiting the complete complex amplitude of the optical field. This design effectively eliminates the need for large-scale ciphertext data acquisition and avoids phase loss inherent to intensity-only detection.
![]()
Figure 1.Structure of the Phys-Encrypt-Net cryptosystem. A 633-nm-laser beam is expanded by a pair of lenses (L1 and L2). The plaintext image is displayed on a DMD. A 4f system formed by lenses L3 and L4 selects the first-order diffraction through a pinhole. The plaintext is then modulated by the diffractive neural network to generate the speckle ciphertext at the output plane. The ciphertext field is further modulated by a fixed phase plate, and the decrypted optical field is recorded by a camera.
2.2. Principle and concept
During the encryption process, as illustrated in Fig. 2(a), we construct a D2NN consisting of four diffractive layers, with each layer containing . These pixels act as artificial neurons capable of receiving, modulating, and propagating the optical field. Each neuron can be regarded as a secondary wave source, with its amplitude and phase determined by the product of the input field and the neuron’s transmission coefficient. As shown in Fig. 2(a), the complex-valued input to the network is the plaintext optical field corresponding to different MNIST handwritten digits. The incident light sequentially passes through the modulation of each diffraction layer, where the system leverages the interaction between light and matter to achieve multi-layer joint modulation of the input field. The output layer produces the speckle ciphertext. More specifically, the neurons in each layer of Phys-Encrypt-Net are connected to the neurons in adjacent layers through free-space wave propagation, following the Rayleigh–Sommerfeld (RS) diffraction equation[26,33]:
![]()
Figure 2.Working principle of the Phys-Encrypt-Net cryptosystem. (a) The multilayer diffractive network modulates the plaintext input into a speckle ciphertext field, achieving optical encryption through the network. (b) During decryption, both the amplitude and phase information of the ciphertext field is utilized. The field is propagated through a fixed phase plate serving as the decoder according to the physical model to generate the distribution at the detection plane. Classification is determined by comparing the energy distributions across 10 detection regions, an error function composed of cross-entropy loss (L1) and MSE loss (L2) is used to update the network parameters, and an additional MSE loss (L3) constrains the raw speckle field (without decoder modulation) to prevent information leakage at the detection plane.
The formula describes how the optical field’s amplitude and phase evolve during propagation between diffractive layers. In the D2NN, this diffraction governs the spatial transformation of the input light across layers, enabling full optical connectivity and complex optical computations. In our implementation, using a phase-only D2NN architecture, the amplitude is assumed to be constant, ideally equal to 1. The transmission coefficient of each neuron is denoted as , which incorporates both amplitude and phase terms, and represents the phase modulation imparted by each diffractive neuron.
In the proposed system, the operation is divided into two main stages. First, the diffractive neural network model, predicts and outputs the ciphertext optical field corresponding to different input fields. Second, the ciphertext field is propagated through a physical model that incorporates a specific decoder, generating the decrypted optical field at predetermined positions. Specifically, the physical constraints are directly embedded into the network optimization through the loss function. Although the network generates encrypted speckle fields, the loss is computed on the decrypted image obtained after modulation by the fixed decryption phase mask. As a result, the gradients backpropagated through the network inherently carry information about the decryption phase mask, effectively embedding the physical constraints into the optimization. This ensures that the learned speckle patterns are physically consistent with the fixed optical decryption mechanism, achieving true synergistic optimization between the neural network and the physical model.
As illustrated in Fig. 2(b), the complex amplitude of the ciphertext field is processed by the physical model to produce the generated optical field distribution. The detection plane captured by the camera is divided into ten circular subregions, each corresponding to a classification category in the D2NN. During inference, the system determines the decrypted class based on the intensity of each subregion. The region with the highest intensity indicates the predicted category, analogous to the softmax mechanism in electronic neural networks. The category corresponding to the peak in the energy distribution histogram is taken as the decrypted label.
During optimization, the weights of the diffractive neural network are determined by RS diffraction theory, while the phase distributions of the diffractive layers serve as learnable bias parameters. By iterating over the training samples, the phase distributions of the D2NN layers are updated through the interaction between the encryption-decryption process (the neural network and the physical model) ultimately yielding a feasible solution that satisfies the imposed physical constraints.
To optimize the network model, we trained Phys-Encrypt-Net using the 60,000-sample MNIST training set and evaluated its performance on 10,000 previously unseen test samples. Each MNIST image was first upsampled to using bilinear interpolation and then zero-padded to to match the network input size. When a plaintext image is provided to the input layer, the predicted ciphertext field is calculated according to RS diffraction theory and the previously described equations. The training objective is to ensure that the network-predicted ciphertext field satisfies the physical constraints imposed by the fixed phase plate in the decryption stage. Specifically, the output of the network should match the phase modulation of the decoder and, through the physical model, generate the decrypted optical field at the designated detection positions. To achieve this, we designed a three-term loss function. First, a cross-entropy loss () measures classification accuracy by determining the region with the maximum energy among the ten detection subregions. Second, a mean squared error (MSE) loss () constrains the intensity distribution of the decrypted field, encouraging the energy to be concentrated in the target detection region (set to 1) while suppressing the others (set to 0). This MSE term further guides the network optimization, maximizing energy utilization and classification stability. Third, an additional MSE loss () on the unregulated (reference) speckle field without passing through the decoder ensures that the speckle pattern itself does not leak class information without the decoder. The final loss is defined as , with , , and . We adopted an iterative training procedure, cycling through all training samples. The learnable phase of the diffractive layers was updated via backpropagation using the Adam optimizer[34]. The network was implemented in TensorFlow (Google Inc.) with Python 3.6.13 and trained on a system equipped with an NVIDIA GeForce RTX 3090 GPU and Intel Xeon Silver 4210R CPU @ 2.40 GHz with 32 GB RAM. The network input size was , with a batch size of 128 and a learning rate of 0.01. Training over the 60,000-sample MNIST dataset for 50 epochs required approximately 153 min.
3. Results
To visually illustrate the performance of the Phys-Encrypt-Net system, Fig. 3(a) presents 10 representative examples, including the plaintext, ciphertext, decrypted field, and the corresponding energy distribution histogram over 10 detection regions. It can be seen that the multilayer diffractive network scrambles the plaintext into random speckle ciphertext, rendering the original image completely unrecognizable and achieving effective optical encryption. The system optimizes the network parameters through training such that different ciphertext fields can match the fixed decoder during decryption, recovering the decrypted optical fields as shown. The decryption results are determined from the energy distribution over the 10 detection regions, with the region exhibiting the highest energy (highlighted in purple) corresponding to the decoded digit. To validate the effectiveness of the system, we evaluated the decryption accuracy of Phys-Encrypt-Net on 10,000 unseen test samples that were not included during training. The evolution of accuracy for both training and test sets over the course of training is shown in Fig. 3(b). As the number of epochs increases, the accuracy for both sets gradually improves and stabilizes after the 20th epoch. The final training accuracy reaches approximately 95.5%, while the test accuracy is around 94.65%. These results demonstrate that the system achieves high decryption accuracy while maintaining strong generalization capability. Compared with conventional D2NN-based light-speed classification methods, Phys-Encrypt-Net preserves similar classification accuracy while simultaneously enabling secure information transmission and light-speed optical decryption, offering a new approach for optical encryption.
![]()
Figure 3.Encryption and decryption performance of Phys-Encrypt-Net. (a) Ten handwritten digit examples showing the plaintext, ciphertext, decrypted image, and the corresponding energy distribution histogram over 10 detection regions. (b) Evolution of decryption accuracy on the training and test sets during the network training process.
The system employs a D2NN composed of multiple diffractive layers as a physical encryption key, generating unique speckle patterns through optical diffraction. The trained model and its parameters, including phase distribution, number of layers, number of neurons, pixel pitch, and inter-layer distances, together constitute a non-clonable encryption key. During decryption, a fixed phase plate serves as the physical decoder, whose phase distribution and spatial positioning also form essential components of the secure key. Correct decryption is only possible when the encryption network and decoder are perfectly matched. As shown in Fig. 4(a), when all key components are correct, the system achieves a decryption accuracy of 94.65% on 10,000 unseen test samples, as reflected in the corresponding confusion matrix. Key sensitivity is a critical aspect of cryptosystems. As shown in Fig. 4(b), using incorrect network parameters leads to performance degradation. Specifically, we replaced the fourth diffractive layer of the network with a random phase distribution while keeping the remaining layers unchanged. The decryption accuracy dropped sharply to 6.46%. During training, the goal of the diffractive network is to generate ciphertext fields that accurately match the modulation of the decoder, thereby satisfying the decryption rules. Consequently, the phase distribution, number of pixels, and feature dimensions of the physical decoder are critical key parameters that directly affect decryption performance. As illustrated in Fig. 4(c), when an incorrect decoder is used and all other key parameters are correct, the confusion matrix shows that the accuracy decreases to 14.84%, making recovery of meaningful information impossible. These results underscore the critical influence of both the encrypted diffractive neural network and the physical decoder on decryption performance, highlighting their dual role as essential elements for accurate decryption and as secure keys for the system.
![]()
Figure 4.Sensitivity analysis of the encryption and decryption keys. (a) Confusion matrix of decryption results for 10,000 unseen test samples when both the encryption and decryption physical keys are correct. (b) Confusion matrix of system decryption results when incorrect diffractive network parameters are used for encryption (incorrect encryption physical key). (c) Confusion matrix of system decryption results when an incorrect decoder is used for decryption (incorrect decryption physical key).
Furthermore, we investigated the impact of the camera’s axial displacement on the decryption performance of the system. In general, axial shifts of the camera reduce the correlation of the speckle field and may degrade decryption quality. As shown in Fig. 5(a), the camera was moved along the optical axis in 5 mm increments over a range of relative to the original detection plane. It presents the decrypted intensity distributions and corresponding energy histograms for the plaintext digit “2” at seven different detection positions. It can be observed that the highest contrast in the decrypted image occurs at 0 mm displacement. As the displacement increases, the speckle field becomes more diffused, and the contrast among the 10 detection regions decreases. Within the range, the energy peak corresponding to digit “2” clearly remains higher than other categories, whereas beyond this range, the energy differences across regions gradually diminish, consistent with the observed degradation in the decrypted images. To quantitatively assess the effect of axial displacement on decryption performance, Fig. 5(b) shows the confusion matrices for different displacements. The decryption accuracies at , , 0 mm, , and were 45.91%, 93.17%, 94.65%, 92.73%, and 47.35%, respectively. These results indicate that the system maintains high decryption performance within a range and exhibits good tolerance to positional errors up to 10 mm. When the displacement exceeds , the accuracy drops below 50%, and the confusion matrices reveal that many decrypted digits are misclassified as neighboring classes. Overall, these results demonstrate that Phys-Encrypt-Net maintains high decryption accuracy within a 10 mm axial range, exhibiting strong robustness and positional tolerance. This physics-driven speckle cryptosystem provides a practical pathway for overcoming challenges in optical encryption related to low positional tolerance and degraded decryption quality, offering a robust and reliable solution.
![]()
Figure 5.Analysis of tolerance to displacement errors. (a) Decrypted images and corresponding energy distribution histograms obtained at seven different axial camera positions. (b) Confusion matrices of the system for all test samples when the camera axial displacement is ±10 mm, ±5 mm, and 0 mm.
To evaluate the practical alignment sensitivity of the proposed Phys-Encrypt-Net, we further investigate its tolerance to angular misalignment. As shown in Fig. 6, a controlled angular tilt is applied to the phase modulation plane by introducing a linear phase ramp, and the corresponding decryption accuracy is measured. The results indicate that the system preserves stable performance for small angular deviations, while the decryption quality gradually degrades as the tilt angle increases. This behavior is consistent with the coherent and interference-based nature of the diffractive decoding process.
![]()
Figure 6.Analysis of tolerance to angular misalignment. The angular misalignment is introduced by adding a linear phase ramp, with the tilt angle varied from −0.06° to +0.06°.
To further assess the generalization capability of the proposed Phys-Encrypt-Net, we tested the system with digit images of sizes different from the training samples. All scale generalization results are obtained in a zero-shot setting. After training the Phys-Encrypt-Net at the original input scale, scaled test images are directly evaluated using the same trained model without any retraining or fine-tuning. Specifically, 9 sets of test samples were constructed with digit sizes varying from 0.8 to 1.2 times that of the training data to systematically evaluate the network’s performance under scale variations.
When the input digit sizes were 0.9, 1.0, and 1.1 times those of the training samples, the corresponding decryption results and confusion matrices are presented in Fig. 7(a), showing decryption accuracies of 92.62%, 94.65%, and 92.84%, respectively, indicating effective recognition of the corresponding speckle ciphertexts. Testing on 30,000 previously unseen samples further demonstrates that the system maintains over 92% accuracy within the 0.9–1.1 scale range, highlighting its stable generalization performance. The variation of decryption accuracy across the 9 sets of test samples with different input sizes is shown in Fig. 7(b). The results indicate that performance is optimal when the input size matches the training data, while slight decreases in accuracy are observed as the size factor increases or decreases. For scale factors of 0.8 and 1.2, the system achieves accuracies of 76.08% and 85.32%, respectively. Despite substantial geometric variations in the input digits, the system retains a significant level of generalization without sharp performance degradation. These results suggest that Phys-Encrypt-Net does not merely memorize statistical features of the training samples but rather learns a stable physical mapping among the input wavefront, speckle, and the embedded physical decoder. In contrast, conventional purely data-driven networks, which rely on large-scale plaintext-ciphertext pairs for pretraining and only capture intensity (amplitude) information of the ciphertexts, typically exhibit limited generalization when insufficient training data are available. By leveraging both amplitude and phase information of the ciphertext field and through the interaction between the diffractive network and the embedded physical model, Phys-Encrypt-Net avoids the high cost of acquiring large-scale ciphertext measurements and enables efficient optimization. The proposed system maintains stable performance under input perturbations, demonstrating strong generalization and practical potential for speckle encryption and decryption applications.
![]()
Figure 7.Generalization performance under varying input scales. (a) Decryption results and corresponding confusion matrices for test sets with different digit sizes, where the digit size scale factors relative to the training data are 0.9, 1.0, and 1.1. (b) Variation of decryption accuracy as a function of the input size scale factor across the test sets.
To further evaluate the performance of our method, we conducted a comparative experiment with a standard Visual Geometry Group (VGG)[12] type convolutional neural network as a baseline. Both methods were trained on limited datasets containing 5000 and 10,000 images and evaluated on a completely unseen test set of 10,000 images. As shown in Fig. 8, the left panel (standard test) presents results on test images that have the same size as the training images but were not seen during training, reflecting the standard generalization capability. The right panel (scale-generalization test) shows results on test images scaled to of their original size, simulating a distribution shift and assessing robustness to variations in input scale. The results clearly demonstrate that our method outperforms VGG even when trained on a small dataset. For instance, when trained with 5000 images, our method achieves higher accuracy than VGG trained with 5000 or even 10,000 images, in both standard and scale-generalization tests. This indicates that our physics-driven approach requires significantly less training data, reducing the cost and effort associated with collecting large-scale datasets. Furthermore, unlike convolutional neural network-based decryption, which relies on GPU-based forward inference, our method performs decryption directly in the optical domain, avoiding digital processing delays. Therefore, this comparison not only demonstrates superior performance under limited data but also highlights the unique advantage of light-speed optical decryption, which is beyond what conventional convolutional neural network-based approaches can achieve.
![]()
Figure 8.Accuracy comparison of the proposed method against the baseline VGG model as a function of training sample size (5000 and 10,000). (a) Results on original test images. (b) Results on scaled test images.
4. Conclusion
In this work, we propose a physics-driven optical cryptosystem, Phys-Encrypt-Net, which for the first time explores the use of diffractive neural network for encryption and embeds a physical model to perform decryption using the full complex amplitude of the ciphertext. This approach eliminates the need for ciphertext measurement, avoiding the high cost associated with acquiring large-scale plaintext-ciphertext pairs while offering high security, low power consumption, and rapid decryption. Phys-Encrypt-Net employs a network as a multilayer scattering medium for encryption, and leverages the amplitude and phase of the ciphertext field to achieve optical-domain decryption through a fixed phase decoder. Unlike purely data-driven approaches, Phys-Encrypt-Net performs decryption directly in the optical domain, thereby avoiding the phase loss problem caused by intensity detection, as well as the decryption latency and power consumption of network inference on GPUs. This physics-driven design enables synergistic optimization between the physical mechanisms and the neural networks, yielding feasible solutions that rigorously satisfy optical constraints. Consequently, it overcomes the generalization limitations inherent in purely data-driven networks trained on limited intensity-only ciphertext images, which struggle to capture the underlying physical mapping between plaintexts and ciphertexts. The diffractive network and the decoder together serve as physical keys, forming a large key space that ensures system security. Phys-Encrypt-Net demonstrate a decryption accuracy exceeding 94.65%, comparable to the classification performance of conventional diffractive neural networks[26,35,36].
Importantly, our system not only enables light-speed information transmission and recognition but also realizes encryption and secure data transfer. Compared with purely data-driven methods, Phys-Encrypt-Net overcomes the limitations of intensity-only measurements and data scarcity, achieving high-security speckle-based cryptosystems at light speed and low power. The proposed framework relies on precise lateral alignment. Such sensitivity is a common characteristic of coherent diffractive and optical encryption systems, where precise spatial alignment is required for accurate wavefront reconstruction. From a security perspective, this lateral alignment sensitivity can be regarded as an additional physical constraint, as successful decryption requires not only the correct encryption parameters but also precise spatial positioning, which is difficult to achieve without full knowledge of the system configuration. Improving tolerance to large lateral misalignments is beyond the scope of the present work and will be investigated in future studies. This work establishes a new paradigm for physically interpretable optical information security systems that do not require large-scale ciphertext acquisition, offering significant implications for meeting modern communication demands for high-speed and secure data transmission.
References
[7] Y. Zhang, B. Wang. Optical image encryption based on interference. Opt. Lett., 33, 2443(2008).
[33] J. W. Goodman. Introduction to Fourier Optics(2005).
[34] D. P. Kingma, J. Ba. Adam: a method for stochastic optimization(2014).
Set citation alerts for the article
Please enter your email address


AI Video Guide
AI Picture Guide
AI One Sentence


