Pat*_*ick 1 python encoding png steganography python-imaging-library
我正在寻找有关如何通过颜色将少量二进制数据(例如,大约200字节)编码到PNG中的信息; 本质上是Hid.im为.torrent文件做的事情.任何有关最佳实践的信息或跳板都将是出色的.
谢谢!
在无损压缩图像中隐藏数据的基本原理是修改每个像素的低位,因此这些位总是意味着什么.
例如,在RGB中,您可以修改红色值中的最后一位(技术上,人眼对红色对绿色或蓝色不敏感).
例如,让我们绘制一条8像素的线,例如每个像素的红色值具有前一个像素的红色+ 1的值
Pixel1 = (120, 203, 391)
Pixel2 = (121, ..., ...)
...
Pixel8 = (128, ..., ...)
Run Code Online (Sandbox Code Playgroud)
以二进制形式,它是:
Pixel1 = (01111000, ..., ...)
Pixel2 = (01111001, ..., ...)
...
Pixel8 = (10000000, ..., ...)
Run Code Online (Sandbox Code Playgroud)
现在,让我们在该行中加密63号:
63 = 00011111
# Encrypting from right to left, by writing the data to the minor bit
Pixel1 = (0111100[0], ..., ...) -> 120
Pixel2 = (0111100[0], ..., ...) -> 120
Pixel3 = (0111101[0], ..., ...) -> 122
Pixel4 = (0111101[1], ..., ...) -> 123
Pixel5 = (0111110[1], ..., ...) -> 125
...
Pixel8 = (1000000[1], ..., ...) -> 129
Run Code Online (Sandbox Code Playgroud)
而已.您知道信息的位置以及如何提取信息.然而,这种方法受容量的限制.
| 归档时间: |
|
| 查看次数: |
1477 次 |
| 最近记录: |