资源简介
1、隐写:分别完成位图格式图像头文件冗余、图片尾部追加和数据区覆盖三种隐写。
2、分析:分别完成位图格式图像头文件冗余、图片尾部追加和数据区覆盖三种隐写图像与正常图像的分析及隐写数据的提取。

代码片段和文件信息
// BMP.cpp: implementation of the BMP class.
//
//////////////////////////////////////////////////////////////////////
#include “stdafx.h“
#include “BMP.h“
#include
#include
using namespace std;
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
BMP::BMP()
{
}
BMP::~BMP()
{
}
bool BMP::setBmpFileName(char *szFileName)
{
memcpy(nameszFileName100);
//strcat(name“.yuan.bmp“);
this->sBmpFileName = szFileName;
if (pBuf) //如果已经生成就释放掉
{
//cout<<“sss“< //delete pBuf;
}
HANDLE hfile = CreateFileA(szFileName GENERIC_READ | GENERIC_WRITE FILE_SHARE_READ | FILE_SHARE_WRITE NULL OPEN_EXISTING 0 0);
if(hfile ==INVALID_HANDLE_VALUE)
{
cout<<“打开文件失败或者没有此文件!“< return false;
}
dwBmpSize = GetFileSize(hfile 0); //获取文件的大小
pBuf = new unsigned char[dwBmpSize];
DWORD dwRead = 0;
ReadFile(hfile pBuf dwBmpSize &dwRead 0);
if (dwRead != dwBmpSize)
{
delete[]pBuf;
pBuf = 0;
return false;
}
CloseHandle(hfile);
m_fileHdr = (BITMAPFILEHEADER*)pBuf;
m_infoHdr = (BITMAPINFOHEADER*)(pBuf + sizeof(BITMAPFILEHEADER));
return true; //成功话就是文件的内容读取到pBuf里面
}
bool BMP::save(int index)
{
string sDstFileName = sBmpFileName + “.yuan.bmp“;
HANDLE hfile = CreateFileA(sDstFileName.c_str()
GENERIC_READ | GENERIC_WRITE
FILE_SHARE_READ | FILE_SHARE_WRITE
NULL
CREATE_ALWAYS 0 0);
if (hfile == INVALID_HANDLE_VALUE)
{
return false;
}
//在一个文件中设置当前的读取位置
SetFilePointer(hfile 0 0 FILE_BEGIN);
DWORD dwWritten = 0;
WriteFile(hfile pBuf dwBmpSize &dwWritten 0);
if (dwBmpSize != dwWritten)
{
return false;
}
CloseHandle(hfile);
return true;
}
bool BMP::headhideBMP(char *s) //头文件隐写hell
{
//char s[10]=“hell“;
int num[8]={0};
int index = 0i;
for(i=0;i {
int in=s[i];
num[index++]=in/16;
num[index++]=in%16;
}
while(index<8)
{
num[index++]=0;
}
int m=0n=0;
int s1[4]={2301};
int s2[4]={6745};
for(i=0;i {
// cout< n=n*16+num[s1[i]];
}
for(i=0;i {
// cout< m=m*16+num[s2[i]];
}
//m_fileHdr->bfReserved1=25960;
//m_fileHdr->bfReserved2=27756;
m_fileHdr->bfReserved1=n;
m_fileHdr->bfReserved2=m;
m_fileHdr->bfSize=122;
return true;
}
bool BMP::headhideBMP1() //判断头文件有无隐写
{
//cout<bfReserved1<<“ “<bfReserved2< if(m_fileHdr->bfReserved1==0&&m_fileHdr->bfReserved2==0)
{
cout<<“图像头文件冗余无隐写“< }
else
cout<<“图像头文件冗余有隐写“< return true;
}
bool BMP::hideString2BMP(char *szStr2Hide) //数据区隐写
{
m_fileHdr->bfReserved1;
LPBYTE pAlpha = pBuf + m_fileHdr->bfOffBits + 4; //第一个像素的通道位置
int nHide; //字节数
for (nHide = 0; (pAlpha - pBuf) < m_fileHdr->bfSize && szStr2Hide[nHide] != 0; nHide
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 673999 2019-04-06 16:31 Steganography\123.bmp
文件 673974 2019-04-06 16:31 Steganography\123.bmp.hide.bmp
文件 692396 2019-04-07 15:53 Steganography\12_2.bmp
文件 692371 2019-04-07 14:32 Steganography\12_2.bmp.hide.bmp
文件 692391 2019-04-07 15:53 Steganography\12_2.bmp.yuan.bmp
文件 3102786 2019-04-07 20:05 Steganography\4_1.bmp
文件 3102783 2019-04-07 20:05 Steganography\4_1.bmp.yuan.bmp
文件 4955 2019-04-07 20:21 Steganography\BMP.cpp
文件 1059 2019-04-07 20:09 Steganography\BMP.h
文件 692276 2019-04-06 13:23 Steganography\Debug\12_2.bmp
文件 692271 2019-04-06 13:23 Steganography\Debug\12_2.bmp.hide.bmp
文件 182811 2019-04-07 20:20 Steganography\Debug\BMP.obj
文件 205305 2019-04-07 20:11 Steganography\Debug\Interface.obj
文件 65046 2019-04-07 20:11 Steganography\Debug\StdAfx.obj
文件 589905 2019-04-07 20:20 Steganography\Debug\Steganography.exe
文件 854976 2019-04-07 20:20 Steganography\Debug\Steganography.ilk
文件 5557 2019-04-07 20:11 Steganography\Debug\Steganography.obj
文件 4009928 2019-04-07 20:11 Steganography\Debug\Steganography.pch
文件 1475584 2019-04-07 20:20 Steganography\Debug\Steganography.pdb
文件 148480 2019-04-07 20:20 Steganography\Debug\vc60.idb
文件 266240 2019-04-07 20:20 Steganography\Debug\vc60.pdb
文件 4529 2019-04-07 20:08 Steganography\Interface.cpp
文件 747 2019-04-06 16:08 Steganography\Interface.h
文件 1250 2019-04-06 12:22 Steganography\ReadMe.txt
文件 361 2019-04-06 12:25 Steganography\StdAfx.cpp
文件 785 2019-04-06 13:32 Steganography\StdAfx.h
文件 210 2019-04-07 15:53 Steganography\Steganography.cpp
文件 4868 2019-04-06 13:54 Steganography\Steganography.dsp
文件 534 2019-04-06 12:22 Steganography\Steganography.dsw
文件 58368 2019-04-07 21:25 Steganography\Steganography.ncb
............此处省略9个文件信息
- 上一篇:服装网上购物商城源代码
- 下一篇:Tecplot流体模拟软件
相关资源
- VisualStudioUninstaller vs卸载工具
- 组态王驱动开发包3.0.0.7(中文)
- 多窗口后台鼠标连点器
- 使用选择性重传协议实现UDP可靠通信
- VC 获得文件属性 获取文件的创建时
- 读者写者问题(读者优先,写者优先
- 用VC 编写的仿QQ聊天室程序源代码
- 外点法程序
- 外罚函数程序
- qt-电子点菜系统
- 推箱子及人工智能寻路C 源代码
- 自己写的航空订票系统c 版--数据结构
- 数据结构实验魔王语言
- MUSIC算法c 实现
- C 餐厅叫号系统(QT平)
- 国际象棋c 完整版
-
ob
jectARX给Auto CAD加工具条 - 画图程序MFC/VC/VC CRectTracker 串行化
- MFC网络编程实例
- c 课程设计 职工信息管理系统
- VC 游戏编程—附源代码
- IpHlpApi.h&IpHlpApi.lib
- 清华大学 c 郑莉 ppt课件
- c 程序判断离散数学中命题公式
- 多项式求和(数据结构C 版)
- vc 6.0开发的流程图编辑器
- VC 天空盒(skyBox)实现(附源代码)
- c MFC 画多边形
- 用C 实现的对网络上的ARP数据包进行
- Microsoft基本类库 (MFC)(C 库)
评论
共有 条评论