Skip to content

Latest commit

Β 

History

History
47 lines (34 loc) Β· 2 KB

File metadata and controls

47 lines (34 loc) Β· 2 KB

πŸ” Image Encryption with XOR Cipher

encrypted-file

πŸ“‹ Overview

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.

πŸ” Detailed Functionality

1️⃣ Input and Initialization

  • πŸ“ The program prompts users for the image file path to be encrypted
  • πŸ”‘ Users must provide a numerical encryption key for the XOR operation

2️⃣ Encryption Process

  • πŸ“‚ 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

Byte Array Representation

  • βš™οΈ 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

3️⃣ Output Generation

  • πŸ’Ύ Writes the encrypted byte array back to the original file location
  • βœ… Displays a confirmation message upon successful encryption

4️⃣ Security Considerations

  • ⚠️ 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

πŸš€ Getting Started

# 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

πŸ“ License

MIT