Image Steganography Using Python
Steganography
Steganography is the technique of hiding secret information.
The steganography hides different types of data within a cover file.
The resulting stego file also contains hidden information, although it is virtually identical to the cover file.
Image Steganography
Image steganography refers to hiding information i.e. text, images, audios, videos, scripts, exe files in another image.
I rely on two directions in this tool to hide information in an image:
1- LSB Method
2- Hexa Decimal for the Image
1- LSB Method
The Least Significant Bit (LSB) steganography is one technique in which the least significant bit of the image is replaced with a data bit. In this method, the least significant bits of some or all of the bytes inside an image are replaced with a bit of the secret message.
An image for describing LSB
A screenshot from the code
To learn more about LSB Steganography follow this link More_about_LSB
2- Hexa Decimal for the Image
Every JPEG/JPG file just like any other object has a beginning or header, called “Start of Image” and a trailer called “End of Image”, every JPEG file starts from the binary value ‘0xFFD8‘ and ends by the binary value ‘0xFFD9‘.
After this value ‘0xFFD9’ we insert our information.
An image for describing jpeg image with its start and end
We know that exe file starts with ‘0x4D5A’.
An image shows that we hid an exe in an image
How to run this script
Install python
Download the latest version of python python
install labriries that we need
pip install ctypes
pip install numpy
pip install opencv-python
pip install tk
pip install os-sys
pip install syspath
pip install python-time
pip install matplotlib
pip install types-all
pip install termcolor
pip install requires.io
pip install Pillow
Run on cmd or terminal
python Hide_data.py
Final Run
A note
There is a demo
Each file has an original image and injected image. If you want to extract information use this key ‘###’