Optical Image Encryption via Double Random Phase Encoding in a 4f Architecture
Double Random Phase Encoding (DRPE) within a 4f optical configuration establishes a deterministic cryptographic framework for visual information protection. The hardware layout consists of two converging lenses spaced exactly two focal lengths apart. When light propagates from an input plane through the first lens to its back focal plane, a Fourier transformation occurs. Propagation through the second lens performs an additional Fourier transform, effectively yielding a spatially inverted replica of the original field. This double-transform property enables the cascaded multiplication of random phase matrices in both spatial and frequency domains.
During encryption, the target image matrix $I(x, y)$ undergoes multiplication with the first spatial random phase mask $P_1(x, y) = e^{j\Phi_1(x, y)}$, where $\Phi_1$ contains uniformly distributed values across $[0, 2\pi)$. The modulated field is transformed into the spectral domain via a Fast Fourier Transform (FFT). At the intermediate Fourier plane, the spectrum is multiplied by a second independent phase mask $P_2(u, v) = e^{j\Phi_2(u, v)}$. A subsequent inverse FFT reconstructs the ciphertext in the output plane. Typically, the complex amplitude or absolute magnitude of this final field serves as the protected payload.
Decryption reverses the operational sequence. The ciphertext enters the receiving 4f setup and encounters the conjugate of the frequency-domain mask, $P_2^(u, v)$. After another Fourier transformation step, the spatial-plane conjugate mask $P_1^(x, y)$ compensates for the initial phase modulation. Two consecutive inverse transforms restore the unaltered pixel values of the source material. Successful recovery requires precise alignment and exact phase key replication; any deviation exceeding approximately ten percent of the operating wavelength introduces significant distortion.
The cryptographic strength of this approach stems from several inherent properties. The continuous nature of phase quantization yields an astronomically large key space, rendering exhaustive search computationally infeasible. Additionally, the scheme demonstrates high resilience against packet loss, Gaussian noise injection, and selective region clipping. Since phase scrambling completely decouples pixel intensity correlations from thier spatial arrangement, statistical analysis and chosen-plaintext attacks fail to converge toward actionable metadata. These characteristics make DRPE suitable for securing medical archives, military surveillance feeds, biometric credential databases, and copyrighted multimedia distributions.
The following MATLAB implementation demonstrates the complete encryption and decryption pipeline. The script generates synthetic phase keys, applies FFT-based propagation, and verifies reconstruction fidelity using peak signal-to-noise ratio metrics.
% Double Random Phase Encryption Framework
clc; clear; close all;
% Load and preprocess input imagery
sourceData = imread('cameraman.tif');
if size(sourceData, 3) == 3
sourceData = rgb2gray(sourceData);
end
sourceData = im2double(sourceData);
% Determine grid dimensions and pad to nearest power of two for computational efficiency
[rows, cols] = size(sourceData);
padRows = nextpow2(rows);
padCols = nextpow2(cols);
N_rows = 2^padRows;
N_cols = 2^padCols;
paddedInput = padarray(sourceData, [N_rows-rows, N_cols-cols], 'post');
% Initialize independent random phase masks
rand('state', 42); % Reproducibility seed
phaseSpatial = exp(1i * 2 * pi * rand(N_rows, N_cols));
phaseFreq = exp(1i * 2 * pi * rand(N_rows, N_cols));
% === ENCRYPTION PHASE ===
% Spatial domain masking
maskedSpectral = paddedInput .* phaseSpatial;
% Fourier transformation to intermediate plane
fourierField = fft2(maskedSpectral);
% Frequency domain masking
scrambledSpectrum = fourierField .* phaseFreq;
% Back-propagation to output plane
encryptedMatrix = ifft2(scrambledSpectrum);
ciphertext = abs(encryptedMatrix); % Retain magnitude for storage
% === DECRYPTION PHASE ===
% Reconstruct complex field from magnitude placeholder
decryptedComplex = encryptedMatrix;
% Remove frequency phase component via conjugate multiplication
correctedSpec = decryptedComplex .* conj(phaseFreq);
freqDomainInv = fft2(correctedSpec); % Note: 4f system acts as double FFT
% Remove spatial phase component via conjugate multiplication
unmaskedField = freqDomainInv .* conj(phaseSpatial);
% Retrieve reconstructed spatial profile
recoveredData = abs(ifft2(unmaskedField));
% Trim padding artifacts
recoveredOrig = recoveredData(1:rows, 1:cols);
% Evaluate reconstruction accuracy
mseVal = mean((sourceData(:) - recoveredOrig(:)).^2);
psnrVal = 10 * log10(1 / mseVal);
% Visualization
figure('Name', 'DRPE Cryptography Workflow');
subplot(2, 3, 1); imshow(sourceData, []); title('Original Source');
subplot(2, 3, 2); imagesc(ciphertext); colormap gray; title('Encrypted Amplitude');
subplot(2, 3, 3); hist(ciphertext(:), 50); title('Amplitude Distribution');
subplot(2, 3, 4); imshow(recoveredOrig, []); title(['Reconstructed (PSNR: ' num2str(psnrVal, '%.1f') ' dB)']);
subplot(2, 3, 5); errorbar(1, mseVal, 'ro'); ylim([0 max(mseVal)*1.1]); title('Mean Squared Error');
subplot(2, 3, 6); imagesc(angle(decryptedMatrix(1:N_rows,1:N_cols))); title('Phase Complexity Map');
This implementation validates the bi-directional invertibility of the algorithm. The symmetric phase modulation ensures that pixel intensity statistics are thoroughly randomized upon encryption, while the exact inverse sequence guarantees precise retrieval under numerical stability limits.