📄 md5.h
字号:
#ifndef __MD5_H__
#define __MD5_H__
/**************************************************************\
功能描述:单向散列函数,md表示的是消息摘要,它对输入的消息运算,
产生128列散列值,
算法原理:
首先填充消息使得数据长度恰好为512的倍数仅小64位的数,
条中方法是附一个1在消息的背后,后接所要求的多个0,
然后在其后附上64位的消息长度,这两部分的作用是让消息长度恰好等于512位的整数倍,
同时确保不同的消息在填充中不相同
创建 :田雪金
日期 :2006-12-11
调用流程:
MD5_CTX ctx;
unsigned char buf[10] = "Xiaozhou";
MD5Init(&ctx);
MD5Update(&ctx,buf,8);
MD5Final(&ctx);
\**************************************************************/
#ifndef PROTOTYPES
#define PROTOTYPES 0
#endif
typedef unsigned char *POINTER;
typedef unsigned short int UINT2;
typedef unsigned long int UINT4;
#if PROTOTYPES
#define PROTO_LIST(list) list
#else
#define PROTO_LIST(list) ()
#endif
//---------- MD5.h----------------------------
#include "stdio.h"
#include "string.h"
/******************************************************\
功能描述:把字串通过MD5加密.
参说说明:
chrDest[out]:目标字串,加密后的字串
chrSource[in]:源字串,加密前的字串
len[in]:要加密的字串的长度
bLower[in]:是否为小写字母(默认为否.)
创建 :田雪金
日期 :2006-12-11
调用实例:
char buf[] = "amoyrico";
char chrDest[50]="";
MD5((char*)chrDest,(const char*)buf,strlen(buf)) ;
\******************************************************/
void MD5(char * chrDest,const char *chrSource,int nSourcelen,bool bLower=false) ;
#endif //__MD5_H__
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -