At the moment, this repository has 3 python functions to do stenography on .png files with no alpha channel and in RGB mode.
embed(path_to_file, message)
decode(path_to_file)
erase(path_to_file)
I plan to add some more later and this repo is a living repo. Notes and URLs will be added to aid the reader in learning about stenography.
The purpose of this repository is to both provide useful functions, and to teach coders about stenography.
The (PNG + RGB + Image Channels == 3) test worked!
Tested on Python 3.7.3 (default, Oct 31 2022, 14:04:00) \n[GCC 8.3.0])
The code was tested on the following image on this URL: https://upload.wikimedia.org/wikipedia/commons/6/6a/PNG_Test.png
Screenshot of successful test is below
- PNG files tend to be easier to work with than JPG because PNG has "lossless compression".
- This code works for images with three channels.
you can check how many channels an image has with:
from PIL import Image
img = Image.open(path_to_file)
print(img.size)
print(len(img.getbands()))
If the len(img.getbands()) is 4, the image has an "alpha channel"
Read this URL to learn more of what an "alpha channel" is:
https://www.makeuseof.com/tag/alpha-channel-images-mean/ - max_message_length = (img.size[0] * img.size[1] * 3) // 8
- The png image must be in RGB mode
Read this URL to learn more:
https://www.howtogeek.com/42393/rgb-cmyk-alpha-what-are-image-channels-and-what-do-they-mean/
- Steganography Online - https://stylesuxx.github.io/steganography/
- Digital Invisible Ink Toolkit - http://diit.sourceforge.net/
- OpenStego - https://www.openstego.com/
- Steganography Studio - http://www.outguess.org/detection.php
- Steganography Wiki - https://en.wikipedia.org/wiki/Steganography
- Image Based Stenography with Python - https://www.geeksforgeeks.org/image-based-steganography-using-python/
- "Steganography in Digital Media: Principles, Algorithms, and Applications" by Jessica Fridrich, Miroslav Goljan, and Dorin Hogea
- "Steganography: Techniques and Applications" by Arun Kumar Singh and Shivendra Singh
- "Applied Cryptography: Protocols, Algorithms, and Source Code in C" by Bruce Schneier
- "Information Hiding: Steganography and Watermarking - Attacks and Countermeasures" by Neil F. Johnson, Zoran Duric, and Sushil Jajodia
- "Handbook of Information and Communication Security" by Peter Stavroulakis and Mark Stamp
Thank you to Pillow! https://pillow.readthedocs.io/en/stable/