This repository implements an encryption and decryption scheme for grayscale images using chaotic maps and XOR operations. The method leverages the properties of chaotic maps to generate pseudo-random sequences that are used to scramble and obfuscate the pixel positions of the image, followed by an XOR operation to enhance security.
- Chaotic Map-Based Scrambling: Utilizes an extended logistic map to generate a pseudo-random sequence for pixel scrambling.
- XOR-Based Encryption: Applies XOR between the pixel values and a generated key stream for an additional layer of security.
- Encryption and Decryption: Supports both encryption and decryption of grayscale images, making it easy to secure and retrieve your data.
- Custom Key Generation: The method allows you to generate a key stream using a seed, ensuring that the encryption is reproducible with the same seed.
- Image Scrambling: The grayscale image is first scrambled using a chaotic map. This reorders the pixel positions based on the generated chaotic indices.
- XOR Operation: The scrambled image is then XORed with a key stream. This key stream is generated using a pseudo-random number generator seeded for reproducibility.
- Decryption: The decryption process is the reverse. The XOR operation is applied again to the encrypted image with the same key stream, followed by descrambling using the reverse of the chaotic map indices.
The extended logistic map is defined as:
Xn+1 = u ∗ Xn ∗ (1− Xn)
This generates a chaotic sequence of values that are used to scramble the pixel positions of the image.
XOR is a common operation used in cryptography. The pixel values are XORed with a key stream to provide additional security. The same key stream is required for decryption.
- Python 3.x
Pillowlibrary for image processingNumPylibrary for numerical operations
Install the required libraries using pip:
pip install pillow numpy