This project implements a steganography technique to hide a sentence in both an image and a text file. The required sentence is based on the student's first name and student ID, which is then converted into a binary stream and embedded within the chosen files.
.
├── img_24_bit_depth_steganography
│   ├── Cameraman_graycale.jpg
│   ├── encoded_image.png
├── text_file_steganography
│   ├── Original_text.txt
│   ├── text_after_steganography.txt
├── sentence_details
│   ├── details.txt
│   ├── details.docx
├── steganography.py
├── README.md
- Sentence Conversion to Binary Stream: The sentence, constructed from the student's first name and ID, is converted into a 7-bit binary stream.
 - Embedding in Image: The binary stream is embedded into the least significant bits of the RGB values of the image.
 - Embedding in Text: The binary stream is embedded into a text file by replacing single spaces with double spaces where needed.
 - Saving Details: The details of the sentence, including its binary and integer ASCII representations, are saved into both a text file and a Word document.
 
The function sentence_to_binary(sentence) converts each character in the sentence to its 7-bit ASCII representation and concatenates these binary values to form a single binary stream.
The function embed_bits_in_image(image_path, binary_stream) performs the following:
- Opens the image and converts it to RGB mode if necessary.
 - Checks if the binary stream can fit within the image pixels.
 - Iterates through the image pixels, embedding each bit of the binary stream into the least significant bit of the RGB channels.
 - Saves the modified image.
 
The function embed_bits_in_text(text_file_path, binary_stream) performs the following:
- Reads the original text file.
 - Iterates through the text, replacing single spaces with double spaces based on the binary stream.
 - Writes the modified text to a new file.
 
The function save_to_file(sentence, binary_stream) performs the following:
- Writes the sentence details to a text file.
 - Creates a Word document containing a table with the sentence details.
 
- Python 3.x
 - PIL (Pillow)
 - python-docx
 
You can install the required libraries using pip:
pip install Pillow python-docx
- 
Ensure your files are in the correct directories:
- Place your image file in 
./img_24_bit_depth_steganography/and updateimage_pathin the script. - Place your original text file in 
./text_file_steganography/and updatetext_file_pathin the script. 
 - Place your image file in 
 - 
Update the
first_nameandstudent_idvariables in themain()function with your details. - 
Run the script:
 
python steganography.py
- Check the generated files:
- Encoded image: 
./img_24_bit_depth_steganography/encoded_image.png - Text after steganography: 
./text_file_steganography/text_after_steganography.txt - Sentence details:
- Text file: 
./sentence_details/details.txt - Word document: 
./sentence_details/details.docx 
 - Text file: 
 
 - Encoded image: 
 
For a student named "Mohamed" with ID "221101060":
- The sentence is 
Mohamed_221101060$ - The 7-bit ASCII binary stream is generated and embedded into both an image and a text file.
 
- Ensure the image is large enough to accommodate the binary stream.
 - The text file should have sufficient spaces to encode the binary stream without altering the content drastically.