A high-security image encryption scheme combining an improved Lorenz chaotic system and neural network optimization.
ChaosNet-IE implements the core ideas from the paper (CN) "基于神经网络优化混沌系统的图像加密算法": generate raw chaotic sequences from an improved Lorenz system, refine them via a BP neural network, then perform pixel permutation and diffusion for robust encryption.
- Neural network assisted enhancement of chaotic sequence quality
- Improved Lorenz dynamics for stronger randomness
- Two-stage processing: permutation + diffusion
- Key derivation via SHA-384(image bytes) -> initial conditions (high key sensitivity)
- Near-ideal entropy (~8.0) and low adjacent-pixel correlation after encryption
ChaosNet-IE/
├── keys/
│ ├── sequences.npz # Trained/optimized chaotic sequences
│ └── initial_values.txt # Initial Lorenz parameters
├── output/
│ ├── encrypted.png
│ └── decrypted.png
├── encrypt.py # Encryption script
├── decrypt.py # Decryption script
├── demo.py # One-click demo
├── lena.png # Test image
└── README.md / README_CN.md
pip install numpy opencv-pythonpython demo.pyPerforms: encryption → decryption → statistics output.
python encrypt.pyOutputs: output/encrypted.png, keys/sequences.npz, keys/initial_values.txt
python decrypt.pyOutputs: output/decrypted.png
- Improved Lorenz system generates chaotic sequences (with warm-up iterations)
- Sequence normalization to [0,1]
- BP neural network (≈10 hidden neurons) refines sequence quality
- Pixel permutation (index scrambling)
- Block-wise diffusion (XOR / additive mapping)
- Produce final cipher image
dx/dt = a(y - x)
dy/dt = bx - xz + y
dz/dt = 200x^2 + 0.01·e^(xy) - cz
graph LR
A[Input Image] --> B[Key Derivation]
B --> C[Improved Lorenz]
C --> D[Neural Network]
D --> E[Permutation]
E --> F[Diffusion]
F --> G[Cipher Image]
| Metric | Plain | Encrypted | Note |
|---|---|---|---|
| Entropy | ~7.0 | ~8.0 | Near ideal randomness |
| Adjacent Corr. | High | <0.001 | Spatial decorrelation |
| Pixel Change Rate | 0% | >99% | Strong diffusion |
| Histogram | Structured | Uniform | Resists frequency analysis |
| Plain | Encrypted | Decrypted |
|---|---|---|
![]() |
![]() |
![]() |
- SHA-384 over raw image bytes -> parse into initial conditions
- 1000 warm-up iterations ensure chaotic regime
- BP network (tanh hidden + linear output) fits/refines series
- Derived indices drive permutation & diffusion vectors
- Keep
keys/files safe; they are required for decryption - Current implementation targets grayscale images (RGB extension: per-channel processing)
- Changing the input image requires regenerating key materials
Paper: 基于神经网络优化混沌系统的图像加密算法 (计算机系统应用) Link: https://www.c-s-a.org.cn/1003-3254/7578.html
- Color image direct support
- GPU acceleration for sequence generation
- Configurable network depth
- Benchmark suite (speed / entropy / NPCR / UACI)
Academic / research only. Not intended for commercial deployment.
For the Chinese version, click the 中文 badge at the top.


