Steganography - lscott1994/PythonPracticum GitHub Wiki
The purpose of StegEncode.py was to read in some text from a user and encode that message into a PPM image. StegDecode.py retrieves the encoded image, decodes it, and returns the message.
StegEncode.py The program first reads in a PPM image file and adds the values to a list. Then, the list of integer values are converted to binary. Using the terminal, the program prompts the user to enter a message. The program will not accept a message if it is too long. Once a message is accepted, the string message is converted to binary and added to a new list of bits. The program iterates through this list and adds each bit in the list to the last bit in each binary value for the list of pixels. Once there are no more bits to add, a special character is added after the last added bit to signify the message has ended. The program converts the list back to integer values and writes a new PPM image.
StegDecode.py The program reads in an encoded PPM image file and adds the values to a list. The program iterates through the list and adds every value to a new message list until it reaches the special character used to depict the end of the message. The program then gets the last bit from each binary number in the message list. This is the actual message, but in binary. The binary is then converted to an ascii string and is combined to show the message.
Testing
The program is able to successfully retrieve a message an encode it into a ppm image. It is also able to successfully decode and retrieve a message from a PPM image. The image below shows a message entered and the message in binary.

Here is a snippet of the message retrieved from the PPM file:

Unfortunately, the program is unsuccessful in discretely being able to encode a message into an image. When the image is saved, the colors in the picture are very different. I believe this occurs from my method in "adding" the last digit. After being unable to successfully implement the decoding, I modified my code so that instead of adding a bit to the least significant bit in the list, I actually removed the last digit from the binary number and replaced it with the bit.
