This project provides a simple implementation of the LZW (Lempel-Ziv-Welch) compression algorithm to compress and decompress images and RSA to encrypt and decrypt the image.
-
Python 3.6+
-
PIL (Python Imaging Library)
pip install pillow
- Clone the repository:
git clone https://github.com/msosav/cvcs-telemedicine-security.git
cd cvcs-telemedicine-security
To use the main.py
script, you need to provide three command-line arguments:
- The first prime number.
- The second prime number.
- Path to the input image.
- Path to save the compressed file.
- Path to save the encrypted file.
- Path to save the decrypted file.
- Path to save the decompressed image.
p
: The first prime number.q
: The second prime number.image_path
: The path to the input image file that you want to compress.compressed_path
: The path where the compressed file will be saved.encrypted_path
: The path where the encrypted file will be saved.decrypted_path
: The path where the decrypted file will be saved.decompressed_image_path
: The path where the decompressed image will be saved.
To run the script, use the following command in your terminal:
python main.py 61 53 ./images/input.bmp ./results/compressed.lzw ./results/encrypted.rsa ./results/decrypted.lzw ./results/decompressed.bmp
This command will:
- Compress the input image using the LZW algorithm.
- Encrypt the compressed file using the RSA algorithm.
- Decrypt the encrypted file using the RSA algorithm.
- Decompress the decrypted file using the LZW algorithm.
├── compression
│ ├── image.py
│ ├── __init__.py
│ └── lzw.py
├── docs
│ ├── compression
│ │ ├── image.py.md
│ │ └── lzw.py.md
│ └── encryption
│ └── rsa.py.md
├── encryption
│ ├── __init__.py
│ └── rsa.py
├── images
│ └── input.bmp
├── main.py
├── README.md
└── results
├── compressed.lzw
├── decompressed.bmp
├── decrypted.lzw
└── encrypted.rsa