This Python implementation demonstrates a basic image encryption algorithm using the XOR cipher technique. It employs symmetric key cryptography, where identical keys are used for both encryption and decryption operations.
- π The program prompts users for the image file path to be encrypted
- π Users must provide a numerical encryption key for the XOR operation
- π Opens the target image in read-binary mode (
'rb') - π Reads the complete image content into memory
- π Converts image data into a byte array for byte-level manipulation
- βοΈ Performs a bitwise XOR operation on each byte using the provided encryption key
- π The XOR operation effectively scrambles the image data by flipping bits according to the key pattern
- πΎ Writes the encrypted byte array back to the original file location
- β Displays a confirmation message upon successful encryption
β οΈ This represents a basic encryption implementation; more sophisticated algorithms are recommended for high-security applications- π Decryption requires performing the XOR operation again with the identical key
- π‘οΈ The current implementation lacks robust error handling mechanisms
- π‘ Future improvements could include validation for file paths and encryption key inputs
# Clone this repository
git clone https://github.com/soheilsheikh/PRODIGY_CS_02.git
# Navigate to the project directory
cd PRODIGY_CS_02
# Run the encryption script
python encrypt.py
