有没有现成的MD5加密函数啊?

来源:百度知道 编辑:UC知道 时间:2024/06/20 06:18:29
类似这样的

bool MD5(char *InputStr, int InputLen, byte *OutputStr, int &OutputLen)

输入一个字符串,能返回加密结果的函数。做程序要用到,谢谢了。
请问您可以编译成功吗? 我编译不过啊,在宏定义那里老是出错
#define FF(a, b, c, d, x, s, ac) { \
(a) += F ((b), (c), (d)) + (x) + ac; \
(a) = ROTATE_LEFT ((a), (s)); \
(a) += (b); \
}

md5.h

////////////////////////////////////////////////////
#ifndef MD5_H
#define MD5_H

#include <string>
#include <fstream>

/* Type define */
typedef unsigned char byte;
typedef unsigned long ulong;

using std::string;
using std::ifstream;

/* MD5 declaration. */
class MD5 {
public:
MD5();
MD5(const void *input, size_t length);
MD5(const string &str);
MD5(ifstream &in);
void update(const void *input, size_t length);
void update(const string &str);
void update(ifstream &in);
const byte* digest();
string toString();
void reset();
private:
void update(const byte *input, size_t length);
void final();
void transform(const byte block[64]);
void encode(const ulong *input, byte *output, size_t length);
void decode(const byte *input, ulong *output, size_t length);
string bytesToHexString(c