如何查看加密图片

发布于 2024-09-02 20:39:24 字数 210 浏览 8 评论 0原文

人们如何查看 wiki 页面上的加密图片?是否有一个特殊的程序可以做到这一点,或者是否有人决定做一些愚蠢的异或只是提出关于欧洲央行的观点?我不是图形专家,所以如果有程序可以查看加密图片,它们是什么?

how do people view encrypted pictures like on this wiki page? is there a special program to do it, or did someone decide to do some silly xor just make a point about ECB? im not a graphics person, so if there are programs to view encrypted pictures, what are they?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

云醉月微眠 2024-09-09 20:39:25

加密作用于字节流。也就是说,它接受一个字节数组并输出另一个字节数组。图像只是一个字节数组。我们将左上角像素的“r”分量分配给第一个字节,将“g”分量分配给第二个字节,将“b”分量分配给第三个字节。旁边像素的“r”分量是第四个字节,依此类推。

因此,要“加密”图像,您只需获取第一个图像中像素的字节数组,对其进行加密(加密通常不会改变字节数 - 除了填充之外),然后使用这些加密的字节作为像素数据第二张图片。

请注意,这与加密整个图像文件不同。通常图像文件具有特定的标头(例如JPEG标头等)。如果您加密了整个文件,那么标头也会被包含在内,并且您将无法在不解密整个文件的情况下“显示”图像。

Encryption works on a stream of bytes. That is, it takes an array of bytes and outputs another array of bytes. Images are also just an array of bytes. We assign the "r" component of the top-left pixel to the first byte, the "g" component to the second byte, the "b" component to the third byte. The "r" component of the pixel next to that is the fourth byte and so on.

So to "encrypt" an image, you just take a byte array of the pixels in the first image, encrypt it (encryption usually doesn't change the number of bytes - apart from padding) and use those encrypted bytes as the pixel data for the second image.

Note that this is different from encrypting an entire image file. Usually an image file has a specific header (e.g. the JPEG header, etc). If you encrypted the whole file then the header would also be included and you wouldn't be able to "display" the image without decrypting the whole thing.

冷弦 2024-09-09 20:39:25

要查看加密图像,图像必须是未压缩的图像格式,例如 bmp。
PNG、JPEG 等是压缩图像,因此您无法显示它们。此外,imgae 标头也必须解压缩。
如果你想像这样加密图片,只需将其转换为未压缩的格式,用十六进制编辑器打开它并保存图像头即可。之后您可以使用 AES/ECB 加密图像。
最后你必须插入原始图像标题。现在您应该能够查看加密的图像。

To view an encrypted image, the image has to be an uncompressed image format for example bmp.
PNG, JPEG and so on are compressed images so you wont't be able to display those. Also the imgae header has to be uncompressed.
If you want to encrypt pictures like this, just convert it to an uncompressed format, open it with an hex editor and save the image header. After that u can encrypt the image with AES/ECB.
At last you have to insert the original image header. Now you should be able to view the encrypted image.

它不仅仅是一个愚蠢的异或(它们都可以使用异或),但是的,它只是强调任何每次将相同输入转换为相同输出的方案都可以轻松发现输入中存在的模式。该图像显示我们如何轻松地在“加密”输出中发现 Tux。作者可以使用任何类型的数据,但使用图像是因为人眼非常擅长发现模式,所以它是一个很好的例子。

正如文章所述,更好的方案使用前一个块的输出来“随机化”下一个块,因此您看不到输出中的模式(如右图所示)。

It's not just a silly XOR (they can all use XOR) but yes, it's just there to emphasize that any scheme which converts the same input to the same output every time makes it easy to spot patterns that were present in the input. The image is there to show how easily we can spot Tux in the "encrypted" output. The author could have used any kind of data, but used an image because the human eye is very good at spotting patterns, so it makes a good example.

As the article says, better schemes use the output of the previous block to "randomize" the next block, so you can't see patterns in the output (a la the image on the right).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文