如何在 jpg 或 gif 照片中隐藏信息?
如何在 jpg 或 gif 等照片文件中写入一些信息而不破坏图像? 当然,不会在照片上显示它,因为整个想法是在照片文件中发送信息而不被任何人检测到(在某种程度上提供安全/隐私)!
How can I write some information inside a photo file like jpg or gif without destroying the image? and of course without showing it on the photo since the whole idea is to send information in the file of photo undetected by anyone (to provide security/privacy to some extent)!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(9)
您可以将 gif 和 zip(您想要隐藏的信息)连接到一个文件中。 Gif 从文件开头读取,而 zip 从文件末尾读取。
要在 Linux 中创建这样的文件:
生成的文件应具有 file1.gif 和 file2.zip 的大小,并且应可由任何 gif 查看器和 zip 文件处理程序打开。
You can concatenate a gif and a zip (the information you want to hide) into one file. Gifs are read from the start of the file, while zips are read from the end of the file.
To create such a file in linux:
The resulting file should have the size of file1.gif and file2.zip together and should be openable by any gif viewer and zip file handler.
我确信有很多方法。 其一:
在照片中,肉眼通常无法注意到颜色的微小变化,或者即使注意到,也很容易被误认为是图片质量的缺陷。
举一个简单的例子,假设您有一个灰度 GIF 图像,其中调色板按从白到黑的顺序排列,中间有平滑的灰度范围。 我不确定您对图形文件格式了解多少,但在 GIF 中,每个像素有一个字节,每个可能的字节值映射到某种特定的颜色。 因此,在这种情况下,我们可以说调色板#0=RGB(0,0,0),调色板#1=RGB(1,1,1),...调色板#255=RGB(255,255,255)。
然后你拍一张普通的、真实的照片。 将您的秘密信息分解成单独的部分。 将每个调色板索引号的最后一位设置为消息的连续位。
例如,假设原始照片的前八个像素是 01 00 C9 FF FF C8 42 43。您的消息以字母“C”开头,ascii 代码 0110 0111。因此您更改第一个字节的最后一位为 0,将字节从 01 更改为 00。将第二个字节的最后一位更改为 1,将字节从 00 更改为 01。将第三个字节的最后一位更改为 1。它已经是 1,因此使得没有不同。 等等。最终编码的 8 个字节为 00 01 C9 FE FF C9 43 43。
颜色的变化非常微妙,任何人看图片都不太可能注意到。 即使他们确实注意到了,除非他们有理由怀疑,否则他们很可能会得出结论:这张照片的质量不太完美。
当然,没有任何规定您必须为秘密消息使用每字节 1 位。 根据您认为可以避免的质量下降程度,您可以使用每字节 2 位,或者只是每隔一个字节更改 1 位,等等。
当然,相同的技术可以用于彩色照片:更改最后一个每个 RGB 分量中的位对每个像素进行 3 位编码,等等。
I'm sure there are many ways. Here's one:
In a photograph, minor variations in color would often be unnoticable to the naked eye, or even if noticed, might easily be mistaken for flaws in the quality of the picture.
So to take a simple example, suppose you had a gray-scale GIF image where the pallette is arranged in order from white to black with a smooth range of grays in between. I'm not sure how much you know about graphic file formats, but in GIF you have one byte per pixel, with each possible byte value mapping to some specific color. So in this case we could say pallette #0=RGB(0,0,0), pallette #1=RGB(1,1,1), ... palette #255=RGB(255,255,255).
Then you take an ordinary, real photograph. Break your secret message into individual bits. Set the last bit of each pallette index number to successive bits of your message.
For example, suppose the first eight pixels of the original photo are, say, 01 00 C9 FF FF C8 42 43. Your message begins with the letter "C", ascii code 0110 0111. So you change the last bit of the first byte to 0, changing the byte from 01 to 00. You change the last bit of the second byte to 1, changing the byte from 00 to 01. You change the last bit of the third byte to 1. It's already 1, so that makes no difference. Etc. You end up with the coded 8 bytes being 00 01 C9 FE FF C9 43 43.
The changes to the colors would be so subtle that it's unlikely that anyone looking at the picture would notice. Even if they did notice, unless they had a reason to be suspicious, they would likely just conclude that the picture was of less-than-perfect quality.
Of course nothing says you have to use 1 bit per byte for the secret message. Depending on how much degradation in quality you think you can get away with, you could use 2 bits per byte, or just change 1 bit in every other byte, etc.
Of course the same technique can be used with color photos: change the last bit in each of the RGB components to encode 3 bits per pixel, etc.
嘿,这种方法称为隐写术。 有了它,我们不仅可以隐藏图像中的消息,还可以隐藏音频、视频和其他格式的消息。
这是一个名为 steganotool 的 opensouce 隐写术软件,该项目是一个开源的隐写术工具,可以使用隐藏位图图像中的文本以及从位图图像中提取文本。
关于隐写术媒介
图像中的隐写术
这种类型的隐写术对于发现信息非常有效,并且可以用于多种目的。 这些目的可以包括身份验证、消息隐藏和加密密钥的传输。 这种类型的隐写术最有效的方法通常是最低有效位方法。 这仅仅意味着隐藏的消息将改变图片中字节的最后一位。 通过改变最后一位,载体图像内该像素的颜色相对不会发生变化。 这可以防止该消息被轻易检测到。 隐藏信息的最佳图像文件类型是 24 位位图。 这是由于文件大小大且质量高。
音频中的隐写术
在音频文件中,隐藏信息最突出的方法是低位编码方法。 低位编码方法有点类似于图像文件中使用的最低有效位方法。 秘密信息附在文件末尾。 低位编码的问题之一是人耳可以注意到它。 如果有人试图隐藏信息,这可能会有风险,因为它很容易被发现。 扩频方法是另一种用于隐藏音频文件信息的方法。 此方法的作用是向音频广播添加随机噪声。 这种方法使信息能够传播到整个频谱并隐藏在随机噪声下。 音频隐写术中看到的最后一种方法是回声隐藏数据。 此方法旨在通过使用声音文件中自然发生的回声来隐藏信息。 然后,可以将额外的声音添加到这些回声中,额外的声音是隐藏的消息。 这是隐藏信息的充分方法,特别是因为它在某些情况下甚至可以改善原始音频文件的声音。
视频中的隐写术
视频中的隐写术基本上是在视频的每一帧中隐藏信息。 视频中只隐藏了少量信息,通常根本不会被注意到,但是隐藏的信息越多,它就会变得越明显。 这种方法也很有效,但必须做得正确,否则会暴露更多信息而不是隐藏。
文档中的隐写术
这基本上是在文档行的末尾添加空格和制表符。 这类
隐写术非常有效,因为在大多数文本/文档编辑器中,人眼看不到空白和制表符的使用。
您还可以参考这个开源项目
这个文章 非常有用。
Hey that method is called as Steganography. With that we can hide messages in not just images but also in audio,vedeo and other formats.
Here is an opensouce Steganography software called steganotool This project is an open source steganography tool that can be used to hide and extract text to/ from Bitmap images.
About Steganography Mediums
Steganography in images
This type of steganography is very effective against discovery and can serve a variety of purposes. These purposes can include authentication, concealing of messages, and transmission of encryption keys. The most effective method for this type of steganography is normally the least significant bit method. This simply means that the hidden message will alter the last bit of a byte in a picture. By altering that last bit, there will be relatively no change to the color of that pixel within the carrier image. This keeps the message from being easily detected. The best type of image file to hide information inside of is a 24 bit Bitmap. This is due the large file size and high quality.
Steganography in Audio
In audio files, the most prominent method for concealing information is the low bit encoding method. The low bit encoding method is somewhat similar to the least significant bit method used in image files. The secret information is attached to the end of the file. One of the issues with low bit encoding is that it can be noticeable to the human ear. If someone is trying to hide information, this could be risky, since it is so easily detectable. The spread spectrum method is another method that has been used in the concealment of information in audio files. What this method does, is it adds random noise to the audio broadcast. This method enables for the information to be spread accross the frequency spectrum and remain hiddden under the random noise. The last method seen in audio steganography is echo hiding data. This method seeks to hide information by using the echos that occur naturally within sound files. Then, extra sound can be added to these echos, extra sound being the concealed message. This is a sufficient way to hide information, expecially since it even improves the sound of the original audio file in some cases.
Steganography In Video
Steganography in Videos is basically hiding of information in each frame of video. Only a small amount of information is hidden inside of video it generally isn’t noticeable at all, however the more information that is hidden the more noticeable it will become. This method is effective as well, but must be done right or else reveal more information instead of hiding.
Steganography In Documents
This is basically adding white space and tabs to the ends of the lines of a document. This type of
Steganography is extremely effective, because the use white space and tabs is not visible to the human eye in most text/document editors.
You can also refer to this open source project
This article can be very useful.
您可以在图像元数据中存储一些信息。 事实上,这就是人类数码相机“标记”其制作的照片的方式(相机型号、日期和时间、GPS 坐标等)。
此数据格式称为 EXIF(可交换图像文件格式)。 有很多如何在编程语言中使用它的示例。 这是 Java 中的示例。
如果您想阻止用户读取这些数据,您可以以某种方式对其进行加密,但他们始终能够将其从您的图片中删除(例如,通过在 Photoshop 中打开并使用“另存为”)。
You can store some information in image metadata. In fact that's how man digital cameras 'tag' the photos their making (camera model, date and time, GPS coords etc.).
This data format is called EXIF (Exchangeable Image File Format). There are a lot of examples how to use it in programming languages. Here's the example in Java.
If you want to prevent users from reading this data you can encrypt them somehow, but they will always be able to remove it from your picture (by opening in Photoshop and using Save As for example).
如果您想隐藏 jpeg 文件中的数据(文本、其他图像等),只需将其附加到文件末尾即可。 查看图像时,您只会看到原始图像,添加的数据将被忽略。
虽然这不是隐藏数据的超级方法,但这是隐藏另一个 jpeg 的好方法,就好像有人在记事本或十六进制编辑器中打开文件一样,他们可能不会注意到有两个 jpeg 而不是一个,因为最后无论如何,第二张图片看起来就像第一张图片一样。
If you want to hide data (text, another image, whatever) in a jpeg file, you can simply append it to the end of the file. When the image is viewed, you'll only see the original image and your added data will be ignored.
While not a super-duper way of hiding data, this is a good way of hiding another jpeg, as if anyone opens the file in notepad or a hex editor, they will probably not notice that there are two jpegs and not one because the end of the second image will just look like the first anyway.
在 Windows 中,您可以使用简单的命令来隐藏图像中的存档:copy /b cat.jpg + Documents.rar cat_new.jpg。
然后使用例如 winrar 从存档中提取图像中的数据。
但更好的方法是使用隐写术。
适用于 Linux 和 Windows 的简单程序: http://linux01.gwdg.de/~alatham/ stego.html
使用这个程序,您将使用密码短语,没有它,没有人会知道您在图片中隐藏了一些数据))
In windows you can use simple command to hide archive in image : copy /b cat.jpg + Documents.rar cat_new.jpg.
And then use for example winrar to extract data ftom image as from archive.
But better way is to use Steganography.
simple program for it for linux and windows : http://linux01.gwdg.de/~alatham/stego.html
using this program you will use pass phrase, without it nobody even will know, that you hided some data in picture ))
gif 文件中的压缩数据是可变大小的块。 每个块以一个长度字节开始。 通常这些块是 255 字节的数据(长度字节为 255),除了最后两个块(最后一个为 0),
但是您可以使用大小可以说明消息的块重新编码 gif
例如,使用 ASCII 文本或字节的字符
1
2
3
4
表示00
< code>0110
11
二进制数据,对 gif 进行字节频率分析将显示少于预期的 255 个字节。
尺寸会比原始尺寸大,但图像看起来完全一样。
compressed data in gif files is in variable sized chunks. each chunk starts with a length byte. Usually these chunks are 255 bytes of data (and the length byte says 255) except for the last two chunks (the last one is 0)
But you could re-code the gif with chunks whose size spells out the message
eg using characters for ASCII text or bytes
1
2
3
4
representing00
01
10
11
binary data,byte-frequency analysis on the gif would reveal fewer than expected 255 bytes.
and the size would be larger than the original, but the image would look exactly the same.
您不需要任何类型的高级工具来隐藏图像中的文件 –– 您只需要了解一些基本的 DOS 命令...只需点击下面的链接,了解如何执行此操作(这是 的简短描述>图像隐写术):
https:// www.youtube.com/watch?v=ox9ArqXtaWw&list=PLqEKOAKK4IbSTfDJZE_lH-DiOjOzZUczx&index=2
You don't need any type of advanced tool to hide a file in an image –– you just you need to know some basic DOS commands… just follow the link below, to see how to do this (it’s a short description of image steganography):
https://www.youtube.com/watch?v=ox9ArqXtaWw&list=PLqEKOAKK4IbSTfDJZE_lH-DiOjOzZUczx&index=2
我实际上发现了国防部、美国原子能委员会和中央情报局发布的数字信息自由法中嵌入的信息。b我只是看到了我想看到的东西,这太奇怪了而且巧合
I've actually found information embedded in digital FOIA releases from DoD, US AEC and CIA.bAm I just seeing what I want to see, it's so freaking weird and coincidentally