Stegnography using python
I crafted a little script to do stegnography in python. Here is the code: https://github.com/Xunius/py_stegnography.
The 3 files in the repo:
- steg.py: this does the core computations, also works as a CLI command.
- steg_ui.pyui: the pythonista ui design.
- steg_pythonista.py: script for use in pythonista.
In the pythonista ui, you are presented with an image selection button, from which you select a "carrier image" from camera roll.
The textview widget below shows the message you intend to hide, or the message read from the "carrier image". So if it's empty, it will try to read a hidden message. If non-empty, it will hide the message into the chosen image, and create a new png version of it.
This is achieved by converting the message into binary, and put that binary stream into the last bits in the color channels in the pixels. If the change is restricted to the last couple of bits, it is invisible to the eyes. The reading process is doing the opposite.
Optionally one can encrypt the message first. But it doesn't seem to work inside pythonista, the encryption part is throwing error at me.
Another issue I noticed is it often freezes after
photos.pick_image(). Any idea why?
Improvements are welcome!
@Jason Perhaps, Try
@ui.in_background def pickImage(self, sender):
@cvp It worked! Thanks!
@ccc Hmmmm, I thought PNG is not compressed so it would be safe already.