An image encryption algorithm that makes use of GF(28) modular arithmetic. The function has been implemented in both C++ and Python.
Input Image | Encrypted Image | Decrypted Image |
---|---|---|
The MIE algorithm makes use of 28 modular arithmetic. Therefore, the encryption and decryption of the image file requires only one function.
i.e., encrypt(encrypt(value)) = value
- Read the image file and convert it to an array of pixels.
- For every pixel of the image, find the Modular Multiplicative Inverse of the RGB values and update it in the array.
- Save the encrypted/decrypted pixel values as image
- The MIE-CPP module uses STB libraries for reading and writing files.
- The MIE-Python module uses OpenCV and Wand packages, so make sure it is installed before trying to use the MIE module.
- Also install: ImageMagick and GhostScript as they are prequisites for Wand.
- Compile and create an executable file of the program.
- Ex:
g++ encryptor.cpp -o encryptor.exe
- Ex:
- Pass the command line arguments for the executable file to perform encryption/decryption.
- i.e.,
encryptor.exe -E input.png output.png
- Usage: <FILE.exe> ((-E/-e/encrypt)/(-D/-d/decrypt)) <INPUT_FILENAME> <OUTPUT_FILENAME>
- i.e.,
- Import the MIE.py file
- Instantiate the MIE or MIE_PDF files depending on your requirement
- MIE
- Load the image using the
MIE.loadImage()
method - Encrypt/Decrypt the image using the
MIE.encrypt()
orMIE.decrypt()
methods - Save the image using the
MIE.saveImage()
method
- Load the image using the
- MIE_PDF
- Load the PDF using the
MIE.getImages()
method - Encrypt/Decrypt the PDF using the
MIE.encryptImages()
orMIE.decryptImages()
methods - The encrypted PDF will be saved automatically
- Load the PDF using the
- End
- Implement own functions for reading/writing image files.
- Pair with another algorithm to make the encryption secure and robust.