您好,欢迎来到爱go旅游网。
搜索
您的当前位置:首页LSB图像隐写

LSB图像隐写

来源:爱go旅游网
图像隐藏技术实现与检测

(1.LSB隐写技术;2.LSB隐写检测;)

摘要:LSB替换隐写基本思想是用嵌入的秘密信息取代载体图像的最低比特位,原来的的7个高位平面与替代秘密信息的最低位平面组合成含隐藏信息的新图形。文章首先简单叙述了BMP位图文件的文件格式,然后根据24位真彩色BMP位图格式与显示方式的特殊性,直接改变图像中像素的最后一位值来嵌入秘密文件,提出了一种对文字信息进行加密的有效方案。

关键字:LSB,信息隐藏,信息安全,BMP位图

Image hiding technology implementation and testing

(1.LSB steganography technology;2.LSB steganography detection)

Abstract:LSB replacement steganography basic idea is to use the embedded secret information to replace the image of the lowest bits, the original 7 high plane and the least significant bit plane of alternative secret information into new graphics containing hidden information.This paper simple describes the BMP file format of the bitmap file, and then according to the 24 true color BMP bitmap format and the particularity of display mode, directly change the values of pixels in the image of the last to embed secret files, puts forward a effective scheme of text information is encrypted.

- 1 -

Keywords:LSB, Information hiding,information security,bit map file

1.背景知识

在编制本算法之前,我们必须了解一些辅助知识,以便我们能够读懂为什么要这样编制程序。首先,我们要了解24位真彩色BMP(Bitmap-File)格式位图的文件结构。位图文件头位图信息头色表实际位图数据图典型BMP文件结构示意图一个典型的位图文件可看成由4个部分组成:位图文件头(bitmap-fileheader)、位图信息头

(bitmap-informationheader)、色表(colortable)和实际位图数据的字节阵列,其具体形式如图1所示。其中前面3个部分包含关于这个图形文件的信息,这3个部分,占据了一个24位真彩色BMP位图文件的前个字节。

2.LSB隐写的实现

LSB的实现就是把bmp位图的数据部分的最低位以此替换成所要隐藏的信息。实现的C语言代码如下:

#include \"stdafx.h\"

#include \"stdio.h\"

#include \"string.h\"

int main(int argc, char* argv[])

{

- 2 -

FILE *in,*out;

int i;

char inFileName[90],outFileName[90];

printf(\"请输入原位图文件的文件名: \\n\");

scanf(\"%s\

printf(\"请输入处理后的文件的文件名: \\n\");

scanf(\"%s\

if((in=fopen(inFileName,\"rb\"))==NULL)

{

printf(\"文件无法打开!\\n\");

return -1;

}

if((out=fopen(outFileName,\"wb\"))==NULL)

- 3 -

{

printf(\"文件无法打开!\\n\");

return -1;

}

for(i=1;!feof(in);i++)

{

if(i<=)

{

fputc(fgetc(in),out);

}

else

{

fputc(~fgetc(in),out);

- 4 -

}

}

printf(\"图片处理成功!\\n\");

fclose(in);

fclose(out);

return 0;

}

实现效果:

(原图)

(处理后的图片)- 5 -

3.LSB隐写检测

3.1直接使用C语言代码将刚才隐写的信息显示出来。

代码:#include \"stdafx.h\"

#include \"stdio.h\"

int main(int argc, char* argv[])

{

FILE *in;

char ch,fileName[90];

unsigned int i;

printf(\"enter fileName: \\n\");

scanf(\"%s\

if((in=fopen(fileName,\"rb\"))==NULL)

{

- 6 -

printf(\"file open fail\");

return -1;

}

fseek(in,L,0);

do

{

ch =0 ;

for(i=0;i<8;i++)

{

ch+=(fgetc(in)&0x01)<}

putchar(ch);

}while(ch);

- 7 -

/*while((ch=fgetc(in))!=EOF)

{

fputc(ch,stdout);

}*/

putchar('\\n');

return 0;

}

显示效果:(ps:图中的中文是隐藏的信息)

- 8 -

3.2对比检测技术

在对比检测技术中,检测过程需要将载体图象(cover-image)和载密图象(stego-image)对比。通常从载体图象和载密图象的像素之间的关联分析、变换域系数的关联分析发现隐藏信息的可能性。这种方法相对简单,但通常情况下,由于载体图象无法获取,因此实际意义不大。

3.3盲检测技术

盲检测技术就是指在没有载体图象的情况下,只通过载密图象检测隐藏信息。通常通过 对自然数字图象特征进行分析,分析嵌入信息后引起的特征改变从而判断是否存在信息的嵌入。盲检测技术的难度较大,但具有更广泛的应用前景。

参考文献:

[1]范辉.VisualC++6.0程序设计简明教程[M].北京:高等教育出版社,2002.

[2]张鑫,杨棉绒.利用BMP文件的特殊结构进行信息加密[J].新乡师专学报,2005,(9).

[3]罗运和.计算机图形学基础[M].北京:中国计量出版社,1998.

- 9 -

因篇幅问题不能全部显示,请点此查看更多更全内容

Copyright © 2019- igat.cn 版权所有 赣ICP备2024042791号-1

违法及侵权请联系:TEL:199 1889 7713 E-MAIL:2724546146@qq.com

本站由北京市万商天勤律师事务所王兴未律师提供法律服务