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

📄 pgmd5.cpp

📁 本软件采用MD5算法生成消息摘要,并且具有针对自然攻击的计算检测错误率的功能
💻 CPP
字号:
#include "stdafx.h"
#include "PgMD5.h"

void Bitconstgen(unsigned short *bitf)
{
	//bitf[0-15] is the value of the i-th bit from 0 to 15 and 
	//bitf[16-31] is the value of the i-th bit complement from 0 to 15.
	unsigned short i,j;
	for (i=0;i<16;i++) bitf[i]=1;
	for (i=0;i<16;i++)
	{
		for(j=0;j<i;j++)
			bitf[i]*=2;
		bitf[i+16]=bitf[i]^65535;
	}
}

void Packetgen(int nByte,unsigned short *uPacket)
{
	int p,i,nWord;
	//caculate the number of words in the packet.
	nWord=(nByte+1)/2+1;
	//generate the value in each words.
	p=nByte%2;
	i=0;
	if (p==1)
	{
		i++;
		uPacket[0]=255*rand()/RAND_MAX;
	}
	while(i<(nWord-1))
	{
		uPacket[i]=65535*rand()/RAND_MAX;
		i++;
	}
    uPacket[i]=0;
}

⌨️ 快捷键说明

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