问题
Can I simply embed tar file inside png image? I`m tried cat file.tar image.png > secret.png, but this not working for me. does have anybody working example? it would be preferable in ruby or python
回答1:
For simplicity's sake, you can use the stepic library.
It will do what you want out of the box:
stepic --encode --image-in=plain.png --data-in=data.tar --out=secret.png
to decode:
stepic --decode --image-in=secret.png --out=data.tar
You can download and install from the stepic webpage
I doubt you're going to be using this for life-critical data, but just in case:
Encrypt the data first!
It's somewhat trivial to recover ordered data from an image using image processing techniques. What you're encoding in the image should have the following properties to keep you safe and to be difficult to discover:
- Be cryptographically secure
- Be indistinguishable from random noise (see 1.)
- Be large enough that all the pixel of the image carry the encrypted data
The reason we do the last one is because it is very easy to detect if the encoded data stops half way down the image. You'll have an image where half has high noise, and half doesn't. In some cases, this is visible to the naked eye, let alone to someone who knows what they're doing.
I don't know if stepic does all this. Rely on it at your own risk.
来源:https://stackoverflow.com/questions/15642361/hide-tar-file-in-png