資源簡介
數(shù)據(jù)包的重組,在e盤下建一個asd文件夾,運行程序結束后,會發(fā)現(xiàn)asd文件夾里有很多子文件夾,每個子文件里面都有一個total,這里面就是數(shù)據(jù)包重組的內(nèi)容。

代碼片段和文件信息
#include“StdAfx.h“
#include
#define?MYLIBAPI?extern?“C“?__declspec(dllimport)
#include“Mydll.h“
///作者:雪蝶
///功能:分段統(tǒng)計1~255的方差、期望/方差,進而判斷數(shù)據(jù)加密沒.
///時間:2014.7
#include?
#include?
#include?
#include?
int?jmpd(char?fileY[])
{
????int?flag_result;??????????//明文密文標記?????????
int?fno=0;????????????????//打開文件成功后操作系統(tǒng)會自動賦予一個號碼
int?fsize=0;??????????????//文件大小,單位字節(jié)
int?k=1;??????????????????//將文件分成K段
unsigned?char?*ptr=0?*ptr_pro;????//ptr_pro保留malloc返回的頭指針
int?char_size=0;??????????//每段的長度
int?num_circle_out?;??????//外循環(huán)次數(shù)
int?num_circle_int?;??????//內(nèi)循環(huán)次數(shù) ??
int?j=0;?
int?i=0;
int?j1j2j3j4;??????????//j1j2j3j4是j每兩位的整數(shù)值
int?n[4]={0123};???????//兩位二進制對應的整數(shù)值
int?cout_1[4]?=?{0};??????//?記錄兩位二進制對應的次數(shù)??
float?P00=0.0?;??????????????//?記錄二進制連續(xù)00出現(xiàn)的概率
????float?P11=0.0?;??????????????//?記錄二進制連續(xù)11出現(xiàn)的概率
int?cout[256]?=?{0};??????//?記錄0~255個ASCII碼對應的次數(shù)數(shù)據(jù)可以整體初始化,不可以整體賦值??
int?str1[256]=??{0};??????//??存儲0~255個ASCII碼對應的整數(shù)值
int?sum=0;????????????????//伯努利之和
?float?num?=?0;????????????//計數(shù)(總字母數(shù))
?float?exp=0.0;????????????//str[i]的數(shù)學期望
?float?exp2=0.0;???????????//str[i]平方的數(shù)學期望
?float?var=0.0;????????????//str[i]的數(shù)學方差
?FILE?*fp1=0*fp2=0;
???for?(i?=?0;i?256;?i++)//0~255個ASCII碼?
??str1[i]?=?i;
??if((fp1?=?fopen(fileY“rb“))==NULL)?//二進制讀取
?{
printf(“cant?open?data.dat???press?any?key?exit!“);
getchar();
return(1);?
}
????????????fno=fileno(fp1);
fsize=filelength(fno);
??if((fp2?=?fopen(“rate.txt““a“))==NULL)
{
?printf(“cant?open?rate.txt???press?any?key?exit!“);
?getchar();
?return(1);?
}
fprintf(fp2?“##############統(tǒng)計結果##############\n\n“);//格式化輸出
//調(diào)試
fprintf(fp2?“數(shù)據(jù)大?。?d\n“fsize);
for(num_circle_out=0;num_circle_out {
if(fsize/k==0)
char_size=(fsize/k+1)*sizeof(unsigned?char);?//sizeof()的單位是字節(jié)
else?
?char_size=(fsize/k+1+fsize%k)*sizeof(unsigned?char);?//sizeof()的單位是字節(jié)
?ptr=(unsigned?char?*)malloc(char_size);
?if?(NULL?==?ptr)?
?{?
?return?(1);?
?}?
?ptr_pro=ptr;
?fread(ptrchar_size1fp1);
/*
?for(i=0;i<54;i++)
?{
??ptr++;???????//以太網(wǎng)頭部14,ip首部20,TCP首部20
?}
??*/???
??for(num_circle_int=0;num_circle_int {??
??????????????????
? ?j=(int)*(ptr++);???//按字節(jié)讀取ptr指向的內(nèi)存
????????????????
?//每兩位取j,出現(xiàn)二進制的00011011即十進制的1234
??j1=j&3;???//取j的低1、2位
??for(i=0;i<4;i++)
?{
?if(n[i]==j1)
?cout_1[i]++;
?????}?
???????????
???? j2=j&12;??//取j的低3、4位
?j2=j2>>2;??
for(i=0;i<4;i++)
{
if(n[i]==j2)
cout_1[i]++;
}
j3=j&48;??//取j的低5、6位
j3=j3>>4;
?for(i=0;i<4;i++)
{
?if(n[i]==j3)
?cout_1[i]++;
}
j4=j&192;?//取j的低7、8位
j4=j4>>6;
for(i=0;i<4;i++)
{
?if(n[i]==j4)
cout_1[i]++;
???????????
}
?if(?j?>=0?
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件???????4572??2015-01-18?20:53??2015011712\2015011712\2015011712.dsp
?????文件????????543??2015-01-17?17:01??2015011712\2015011712\2015011712.dsw
?????文件??????50176??2015-01-19?10:10??2015011712\2015011712\2015011712.ncb
?????文件??????51712??2015-01-18?21:55??2015011712\2015011712\2015011712.opt
?????文件???????1129??2015-01-19?10:08??2015011712\2015011712\2015011712.plg
?????文件???29425664??2015-03-16?22:05??2015011712\2015011712\2015011712.sdf
?????文件????????965??2015-01-19?14:55??2015011712\2015011712\2015011712.sln
?????文件???????2560??2015-01-17?20:17??2015011712\2015011712\2015011712.suo
????..A..H.?????30720??2015-03-16?22:05??2015011712\2015011712\2015011712.v12.suo
?????文件???????5265??2015-01-17?20:17??2015011712\2015011712\2015011712.vcproj
?????文件???????6900??2015-01-19?12:21??2015011712\2015011712\2015011712.vcxproj
?????文件???????1299??2015-01-19?11:57??2015011712\2015011712\2015011712.vcxproj.filters
?????文件????8350720??2015-03-16?22:02??2015011712\2015011712\Debug\2015011712.bsc
?????文件???????1793??2015-01-31?10:51??2015011712\2015011712\Debug\2015011712.Build.CppClean.log
?????文件?????635904??2015-03-16?22:02??2015011712\2015011712\Debug\2015011712.exe
?????文件????1315076??2015-03-16?22:02??2015011712\2015011712\Debug\2015011712.ilk
?????文件?????????83??2015-03-16?22:04??2015011712\2015011712\Debug\2015011712.log
?????文件????2845696??2015-03-16?22:02??2015011712\2015011712\Debug\2015011712.pdb
?????文件????????165??2015-03-16?22:04??2015011712\2015011712\Debug\2015011712.tlog\2015011712.lastbuildstate
?????文件???????1064??2015-03-16?22:02??2015011712\2015011712\Debug\2015011712.tlog\BscMake.command.1.tlog
?????文件????????528??2015-03-16?22:02??2015011712\2015011712\Debug\2015011712.tlog\bscmake.read.1.tlog
?????文件????????374??2015-03-16?22:04??2015011712\2015011712\Debug\2015011712.tlog\bscmake.write.1.tlog
?????文件???????4626??2015-03-16?22:02??2015011712\2015011712\Debug\2015011712.tlog\cl.command.1.tlog
?????文件??????40892??2015-03-16?22:02??2015011712\2015011712\Debug\2015011712.tlog\CL.read.1.tlog
?????文件???????1754??2015-03-16?22:04??2015011712\2015011712\Debug\2015011712.tlog\CL.write.1.tlog
?????文件???????2740??2015-03-16?22:02??2015011712\2015011712\Debug\2015011712.tlog\li
?????文件???????3096??2015-03-16?22:02??2015011712\2015011712\Debug\2015011712.tlog\li
?????文件????????574??2015-03-16?22:04??2015011712\2015011712\Debug\2015011712.tlog\li
?????文件???????4658??2015-01-17?20:17??2015011712\2015011712\Debug\BuildLog.htm
?????文件??????25320??2015-03-16?22:00??2015011712\2015011712\Debug\Mydll.obj
............此處省略30個文件信息
- 上一篇:中國象棋機器博弈引擎
- 下一篇:基于模型的開發(fā)與自動代碼生成
評論
共有 條評論