⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 stgraphdlg.cpp

📁 将文本文件隐藏在一个BMP文件里 达到信息隐藏的目的
💻 CPP
📖 第 1 页 / 共 2 页
字号:
{
	temp=128*recBin[i]+64*recBin[i+1]+32*recBin[i+2]+16*recBin[i+3]+8*recBin[i+4]+4*recBin[i+5]+2*recBin[i+6]+1*recBin[i+7];
	mssg=mssg+temp;
	m_progress.SetPos (i+l);
	
// ** reading the last bit in each 8 bit (these the txt file bits)	**
// ** converting them to decimal again (ascii code)					**
// ** We got at last !! the txt file in the mssg					**
}


delete [] buffer;
delete [] recBin;


dllg.m_result =mssg;
dllg.DoModal ();

// ** display the txt file											**

f.Close ();
	
}

void CStGraphDlg::OnDO_IT() 
{

// ** This function begin the processing of puting	** 
// ** text bits into the bmp buffer then writing it **
// ** to the bmp file								**

int mask=254; // ** Mask (in the bin.) = 1111 1110	**



	if (bmpLen<binLen) // ** Check if the bmp large enough for **
		               // ** the text to be hidden or not      ** 
	{
		CString temp="The Image Size is so small , we need an image at least ";
		char buffer1[50];
		_gcvt( floor(1.1*sqrt(binLen)) , 10, buffer1 );
		// ** Convert the no. to a string.						**
		temp=temp+buffer1;
		temp=temp+ " X " +buffer1+" pixels.";
		AfxMessageBox(temp);
	}

// ** Important note :
// ** the header of the bmp is about 54 bytes						**
// ** so the data of the bmp begins just after the header			**

	
	for (int i=0 ; i<binLen ; i++)

	{
		srcBMP[i+55]=srcBMP[i+55] & mask;
		
// ** Here we want to change the last bit in each byte of			**
// ** the bmp , so to be able after that to change it to 1			**
// ** or to leave it zero											**
// ** if a byte is xxxx xxx1 was ANDed by 1111 1110 = xxxx xxx0		**
// ** if a byte is xxxx xxx0 was ANDed by 1111 1110 = xxxx xxx1		**
// ** So by this way ,i didn't change any bits except the last		**
// ** the last bit.													**

		if (srcBin[i]=='1')  
			srcBMP[i+55]=srcBMP[i+55]+1;
// ** Now each bit of the text file will be stored in the last bit	**
// ** if the bit is '1' then simply add one							**
// ** if bit=1 ---> ( xxxx xxx0 + 0000 00001 = xxxx xxx1 )			**
// ** if bit=0 ---> ( nothing more needed to be done )				**

	}

	bmpFile.SeekToBegin ();
	bmpFile.WriteHuge (srcBMP,bmpLen); // ** Writing the buffer		**
									   // ** after it was changed	**

	bmpFile.Close ();


CWnd * koko=GetDlgItem (IDC_BUTTON2);
koko->EnableWindow (false);
koko=GetDlgItem (IDC_BUTTON4);
koko->EnableWindow (false);

AfxMessageBox("Text now became hidden .... :) ");
}

void CStGraphDlg::OnClose() 
{
	// TODO: Add your message handler code here and/or call default
	delete [] srcBin;
	delete [] srcBMP;

	CDialog::OnClose();
}

void CStGraphDlg::CreateBinLookUpTable()
{

// ** This Function is used to create a decimal to binary conveter	**
// ** Simply the index of the array bin[] is the dec. no.			**
// ** The binary equivalent  will be the value of bin[dec. no.]		**


// **	bin[dec. no.]="binary value"								**

// ** There is many methods to create this function.				**
// ** But from the fastest methods is creating Look up table		** 

bin[0]="00000000";
bin[1]="00000001";
bin[2]="00000010";
bin[3]="00000011";
bin[4]="00000100";
bin[5]="00000101";
bin[6]="00000110";
bin[7]="00000111";
bin[8]="00001000";
bin[9]="00001001";
bin[10]="00001010";
bin[11]="00001011";
bin[12]="00001100";
bin[13]="00001101";
bin[14]="00001110";
bin[15]="00001111";
bin[16]="00010000";
bin[17]="00010001";
bin[18]="00010010";
bin[19]="00010011";
bin[20]="00010100";
bin[21]="00010101";
bin[22]="00010110";
bin[23]="00010111";
bin[24]="00011000";
bin[25]="00011001";
bin[26]="00011010";
bin[27]="00011011";
bin[28]="00011100";
bin[29]="00011101";
bin[30]="00011110";
bin[31]="00011111";
bin[32]="00100000";
bin[33]="00100001";
bin[34]="00100010";
bin[35]="00100011";
bin[36]="00100100";
bin[37]="00100101";
bin[38]="00100110";
bin[39]="00100111";
bin[40]="00101000";
bin[41]="00101001";
bin[42]="00101010";
bin[43]="00101011";
bin[44]="00101100";
bin[45]="00101101";
bin[46]="00101110";
bin[47]="00101111";
bin[48]="00110000";
bin[49]="00110001";
bin[50]="00110010";
bin[51]="00110011";
bin[52]="00110100";
bin[53]="00110101";
bin[54]="00110110";
bin[55]="00110111";
bin[56]="00111000";
bin[57]="00111001";
bin[58]="00111010";
bin[59]="00111011";
bin[60]="00111100";
bin[61]="00111101";
bin[62]="00111110";
bin[63]="00111111";
bin[64]="01000000";
bin[65]="01000001";
bin[66]="01000010";
bin[67]="01000011";
bin[68]="01000100";
bin[69]="01000101";
bin[70]="01000110";
bin[71]="01000111";
bin[72]="01001000";
bin[73]="01001001";
bin[74]="01001010";
bin[75]="01001011";
bin[76]="01001100";
bin[77]="01001101";
bin[78]="01001110";
bin[79]="01001111";
bin[80]="01010000";
bin[81]="01010001";
bin[82]="01010010";
bin[83]="01010011";
bin[84]="01010100";
bin[85]="01010101";
bin[86]="01010110";
bin[87]="01010111";
bin[88]="01011000";
bin[89]="01011001";
bin[90]="01011010";
bin[91]="01011011";
bin[92]="01011100";
bin[93]="01011101";
bin[94]="01011110";
bin[95]="01011111";
bin[96]="01100000";
bin[97]="01100001";
bin[98]="01100010";
bin[99]="01100011";
bin[100]="01100100";
bin[101]="01100101";
bin[102]="01100110";
bin[103]="01100111";
bin[104]="01101000";
bin[105]="01101001";
bin[106]="01101010";
bin[107]="01101011";
bin[108]="01101100";
bin[109]="01101101";
bin[110]="01101110";
bin[111]="01101111";
bin[112]="01110000";
bin[113]="01110001";
bin[114]="01110010";
bin[115]="01110011";
bin[116]="01110100";
bin[117]="01110101";
bin[118]="01110110";
bin[119]="01110111";
bin[120]="01111000";
bin[121]="01111001";
bin[122]="01111010";
bin[123]="01111011";
bin[124]="01111100";
bin[125]="01111101";
bin[126]="01111110";
bin[127]="01111111";
bin[128]="10000000";
bin[129]="10000001";
bin[130]="10000010";
bin[131]="10000011";
bin[132]="10000100";
bin[133]="10000101";
bin[134]="10000110";
bin[135]="10000111";
bin[136]="10001000";
bin[137]="10001001";
bin[138]="10001010";
bin[139]="10001011";
bin[140]="10001100";
bin[141]="10001101";
bin[142]="10001110";
bin[143]="10001111";
bin[144]="10010000";
bin[145]="10010001";
bin[146]="10010010";
bin[147]="10010011";
bin[148]="10010100";
bin[149]="10010101";
bin[150]="10010110";
bin[151]="10010111";
bin[152]="10011000";
bin[153]="10011001";
bin[154]="10011010";
bin[155]="10011011";
bin[156]="10011100";
bin[157]="10011101";
bin[158]="10011110";
bin[159]="10011111";
bin[160]="10100000";
bin[161]="10100001";
bin[162]="10100010";
bin[163]="10100011";
bin[164]="10100100";
bin[165]="10100101";
bin[166]="10100110";
bin[167]="10100111";
bin[168]="10101000";
bin[169]="10101001";
bin[170]="10101010";
bin[171]="10101011";
bin[172]="10101100";
bin[173]="10101101";
bin[174]="10101110";
bin[175]="10101111";
bin[176]="10110000";
bin[177]="10110001";
bin[178]="10110010";
bin[179]="10110011";
bin[180]="10110100";
bin[181]="10110101";
bin[182]="10110110";
bin[183]="10110111";
bin[184]="10111000";
bin[185]="10111001";
bin[186]="10111010";
bin[187]="10111011";
bin[188]="10111100";
bin[189]="10111101";
bin[190]="10111110";
bin[191]="10111111";
bin[192]="11000000";
bin[193]="11000001";
bin[194]="11000010";
bin[195]="11000011";
bin[196]="11000100";
bin[197]="11000101";
bin[198]="11000110";
bin[199]="11000111";
bin[200]="11001000";
bin[201]="11001001";
bin[202]="11001010";
bin[203]="11001011";
bin[204]="11001100";
bin[205]="11001101";
bin[206]="11001110";
bin[207]="11001111";
bin[208]="11010000";
bin[209]="11010001";
bin[210]="11010010";
bin[211]="11010011";
bin[212]="11010100";
bin[213]="11010101";
bin[214]="11010110";
bin[215]="11010111";
bin[216]="11011000";
bin[217]="11011001";
bin[218]="11011010";
bin[219]="11011011";
bin[220]="11011100";
bin[221]="11011101";
bin[222]="11011110";
bin[223]="11011111";
bin[224]="11100000";
bin[225]="11100001";
bin[226]="11100010";
bin[227]="11100011";
bin[228]="11100100";
bin[229]="11100101";
bin[230]="11100110";
bin[231]="11100111";
bin[232]="11101000";
bin[233]="11101001";
bin[234]="11101010";
bin[235]="11101011";
bin[236]="11101100";
bin[237]="11101101";
bin[238]="11101110";
bin[239]="11101111";
bin[240]="11110000";
bin[241]="11110001";
bin[242]="11110010";
bin[243]="11110011";
bin[244]="11110100";
bin[245]="11110101";
bin[246]="11110110";
bin[247]="11110111";
bin[248]="11111000";
bin[249]="11111001";
bin[250]="11111010";
bin[251]="11111011";
bin[252]="11111100";
bin[253]="11111101";
bin[254]="11111110";
bin[255]="11111111";



}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -