ImageVerifierCode 换一换
格式:DOCX , 页数:14 ,大小:18.70KB ,
资源ID:21117995      下载积分:3 金币
快捷下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

加入VIP,免费下载
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.bdocx.com/down/21117995.html】到电脑端继续下载(重复下载不扣费)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录  

下载须知

1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。
2: 试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。
3: 文件的所有权益归上传用户所有。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 本站仅提供交流平台,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

版权提示 | 免责声明

本文(MD5算法程序Word下载.docx)为本站会员(b****6)主动上传,冰豆网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知冰豆网(发送邮件至service@bdocx.com或直接QQ联系客服),我们立即给予删除!

MD5算法程序Word下载.docx

1、#define PROTO_LIST(list) ()/* F, G, H and I are basic MD5 functions.*/#define F(x, y, z) (x) & (y) | (x) & (z)#define G(x, y, z) (x) & (z) | (y) & (z)#define H(x, y, z) (x) (y) (z)#define I(x, y, z) (y) (x) | (z)/* ROTATE_LEFT rotates x left n bits.*/ #define ROTATE_LEFT(x, n) (x) (32-(n)/* FF, GG,

2、HH, and II transformations for rounds 1, 2, 3, and 4.Rotation is separate from addition to prevent recomputation.*/#define FF(a, b, c, d, x, s, ac) (a) += F (b), (c), (d) + (x) + (UINT4)(ac); (a) = ROTATE_LEFT (a), (s); (a) += (b);#define GG(a, b, c, d, x, s, ac) (a) += G (b), (c), (d) + (x) + (UINT

3、4)(ac);#define HH(a, b, c, d, x, s, ac) (a) += H (b), (c), (d) + (x) + (UINT4)(ac); #define II(a, b, c, d, x, s, ac) (a) += I (b), (c), (d) + (x) + (UINT4)(ac);#define MD_CTX MD5_CTX#define MDInit MD5Init#define MD5Update MD5Update#define MDFinal MD5Final/* Length of test block, number of test block

4、s.*/#define TEST_BLOCK_LEN 10000#define TEST_BLOCK_COUNT 10000/* POINTER defines a generic pointer type */typedef unsigned char *POINTER;/* UINT2 defines a two byte word */typedef unsigned short int UINT2;/* UINT4 defines a four byte word */typedef unsigned long int UINT4;/* MD5 context. */typedef s

5、truct UINT4 state4; /* state (ABCD) */ UINT4 count2; /* number of bits, modulo 264 (lsb first) */ unsigned char buffer64; /* input buffer */ MD5_CTX;void MD5Init PROTO_LIST (MD5_CTX *);void MD5Update PROTO_LIST(MD5_CTX *, unsigned char *, unsigned int);void MD5Final PROTO_LIST (unsigned char 16, MD5

6、_CTX *);static void MD5Transform PROTO_LIST (UINT4 4, unsigned char 64);static void Encode PROTO_LIST(unsigned char *, UINT4 *, unsigned int);static void Decode PROTO_LIST(UINT4 *, unsigned char *, unsigned int);static void MD5_memcpy PROTO_LIST (POINTER, POINTER, unsigned int);static void MD5_memse

7、t PROTO_LIST (POINTER, int, unsigned int);static unsigned char PADDING64 = 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0;/* MD5 initialization. Begins a

8、n MD5 operation, writing a new context.*/void MD5Init (MD5_CTX *context) /* context */ context-count0 = context-count1 = 0; /* Load magic initialization constants.*/state0 = 0x67452301;state1 = 0xefcdab89;state2 = 0x98badcfe;state3 = 0x10325476;/* Note: Replace for loop with standard memcpy if possi

9、ble.*/static void MD5_memcpy (POINTER output, POINTER input,unsigned int len) unsigned int i; for (i = 0; i len; i+) outputi = inputi; with standard memset if possible.*/static void MD5_memset (POINTER output,int value,unsigned int len) (char *)output)i = (char)value;/* Decodes input (unsigned char)

10、 into output (UINT4). Assumes len isa multiple of 4.*/static void Decode (UINT4 *output, unsigned char *input, unsigned int len) unsigned int i, j; for (i = 0, j = 0; j i+, j += 4) outputi = (UINT4)inputj) | (UINT4)inputj+1) 8) | (UINT4)inputj+2) 16) | (UINT4)inputj+3) count0 3) & 0x3F); /* Update n

11、umber of bits */ if (context-count0 += (UINT4)inputLen 3) (UINT4)inputLen count1+;count1 += (UINT4)inputLen 29); partLen = 64 - index; /* Transform as many times as possible.*/ if (inputLen = partLen) MD5_memcpy(POINTER)&context-bufferindex, (POINTER)input, partLen); MD5Transform (context-state, con

12、text-buffer); for (i = partLen; i + 63 state, &inputi); index = 0; else i = 0; /* Buffer remaining input */ MD5_memcpy(POINTER)&bufferindex, (POINTER)&inputi,inputLen-i);/* Encodes input (UINT4) into output (unsigned char). Assumes len is a multiple of 4.*/static void Encode (unsigned char *output,

13、UINT4 *input,unsigned int len) i+, j += 4) outputj = (unsigned char)(inputi & 0xff); outputj+1 = (unsigned char)(inputi 8) & outputj+2 = (unsigned char)(inputi 16) & outputj+3 = (unsigned char)(inputi 24) &/* MD5 finalization. Ends an MD5 message-digest operation, writing the the message digest and zeroizing the context.*/void MD5Final (unsigned char digest16, MD5_CTX *context) unsigned char bits8; unsigned int index, padLen; /* Save number of bits */ Encode (bits, context-count, 8); /* Pad out to 56 mod 64.*/ 0x3f); padLen = (index 56) ? (56 - index) : (120 - index); MD5Update (c

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1