A cryptographic implementation that leverages chaotic dynamical systems for secure image encryption. This project utilizes the mathematical properties of Arnold's cat map and Henon map to generate pseudo-random sequences for encryption keys, providing enhanced security through deterministic chaos theory.
This project implements two chaos-based encryption algorithms:
- Arnold Cat Map: A discrete chaotic map that performs geometric transformations on images
- Henon Map: A dynamical system that generates pseudo-random bit sequences for XOR encryption
The combination of these methods provides a robust encryption system that scrambles image pixels spatially (Arnold) and modifies pixel values cryptographically (Henon).
- Dual encryption approach: Combines spatial scrambling with value transformation
- Support for both grayscale and color images
- Reversible encryption/decryption process
- Chaos theory-based security
- Automatic key generation from chaotic sequences
PIL (Pillow)
numpy
opencv-python (cv2)
matplotlib
tqdmInstall dependencies:
pip install pillow numpy opencv-python matplotlib tqdm- Clone this repository:
git clone https://github.com/yourusername/chaos-map-encryption.git
cd chaos-map-encryption- Install required packages:
pip install -r requirements.txt- Download sample images (included in code):
- HorizonZero.png
- lena.bmp
getImageMatrix(imageName): Converts image to matrix format and extracts metadata
ArnoldCatTransform(img, num): Applies single Arnold transformationArnoldCatEncryption(imageName, key): Encrypts image using Arnold cat mapArnoldCatDecryption(imageName, key): Decrypts Arnold-encrypted image
genHenonMap(dimension, key): Generates transformation matrix using Henon mapHenonEncryption(imageName, key): Encrypts image using Henon map with XOR operationHenonDecryption(imageNameEnc, key): Decrypts Henon-encrypted image
dec(bitSequence): Converts binary sequence to decimal
The Arnold cat map applies the transformation:
x' = (x + y) mod n
y' = (x + 2y) mod n
This creates a chaotic scrambling effect that disperses pixel correlations.
The Henon map generates chaotic sequences using:
x(n+1) = y(n) + 1 - 1.4 * x(n)²
y(n+1) = 0.3 * x(n)
The generated values are converted to binary sequences for XOR encryption.
# Arnold Cat Map Encryption
encrypted_img = ArnoldCatEncryption("input_image.png", key=5)
# Arnold Cat Map Decryption
decrypted_img = ArnoldCatDecryption("input_image_ArnoldcatEnc.png", key=5)
# Henon Map Encryption
HenonEncryption("input_image.png", key=[0.1, 0.2])
# Henon Map Decryption
HenonDecryption("input_image_HenonEnc.png", key=[0.1, 0.2])- Key Type: Integer
- Range: Positive integers (typically 1-20 for optimal results)
- Security: Higher values increase scrambling iterations
- Key Type: List of two float values [x₀, y₀]
- Range: Typically [-1.5, 1.5] for both values
- Security: Initial conditions determine the entire chaotic sequence
- Period: Depends on image dimensions
- Reversibility: Guaranteed after a specific number of iterations
- Security: Based on geometric pixel shuffling
- Chaos Parameters: a = 1.4, b = 0.3 (classical values)
- Lyapunov Exponent: Positive, indicating chaotic behavior
- Sensitivity: Small changes in initial conditions lead to vastly different sequences
- Key Space: Large key space due to floating-point precision in Henon map
- Avalanche Effect: Small key changes result in completely different encrypted images
- Statistical Security: Encrypted images should pass randomness tests
- Brute Force Resistance: Computationally infeasible due to chaotic key generation
- Image Size: Arnold map works best with square images
- Computational Complexity: O(n²) for both algorithms
- Key Sensitivity: Exact key values required for successful decryption
- Floating Point Precision: May affect decryption accuracy across different systems
The implementation includes sample images for testing:
- HorizonZero.png: Color image testing
- lena.bmp: Grayscale image testing
chaos-theory encryption cryptography arnold-map henon-map data-security dynamical-systems chaos-based-cryptography nonlinear-dynamics python image-processing security mathematics chaotic-maps
Note: This implementation is for educational and research purposes. For production use, additional security measures and thorough cryptanalysis should be conducted.