我来我网
https://5come5.cn
 
您尚未 登录  注册 | 菠菜 | 软件站 | 音乐站 | 邮箱1 | 邮箱2 | 风格选择 | 更多 » 
 

本页主题: 为什么我创建的类不能被识别? 显示签名 | 打印 | 加为IE收藏 | 收藏主题 | 上一主题 | 下一主题

再不斩



性别: 帅哥 状态: 该用户目前不在线
等级: 鹤立鸡群
发贴: 1414
威望: 0
浮云: 1413
在线等级:
注册时间: 2005-12-23
最后登陆: 2009-04-26

5come5帮你背单词 [ gossip /'gosip/ n. 闲话,流言,闲谈;vi. 搬弄是非,闲聊 ]


为什么我创建的类不能被识别?

我的MFC程序里要用到MD5加密,我就在StdAfx.cpp里建了几个函数,是关于MD5加密的,但是编译出错了,很多。。。
以下是StdAfx.h文件里声明部分,问题就出在这儿了:
Copy code
//MD5加密部分
#ifndef _MD5_H_
#define _MD5_H_
#endif //_MD5_H_

/* Constants for MD5Transform routine.
*/
#define S11 7
#define S12 12
#define S13 17
#define S14 22
#define S21 5
#define S22 9
#define S23 14
#define S24 20
#define S31 4
#define S32 11
#define S33 16
#define S34 23
#define S41 6
#define S42 10
#define S43 15
#define S44 21

#define TEST_BLOCK_LEN 1000
#define TEST_BLOCK_COUNT 1000
/* 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) << (n)) | ((x) >> (32-(n))))

/* FF, GG, 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));\  //error C2501: 'a' : missing storage-class or type specifiers
//error C2065: 's' : undeclared identifier
(a) += (b);\  //error C2143: syntax error : missing ';' before '+='
//error C2086: 'a' : redefinition
}
//并且在以下的GG、HH、II都有类似的错误
#define GG(a, b, c, d, x, s, ac) { \
(a) += G ((b), (c), (d)) + (x) + (UINT4)(ac); \
(a) = ROTATE_LEFT ((a), (s)); \
(a) += (b); \
}
#define HH(a, b, c, d, x, s, ac) { \
(a) += H ((b), (c), (d)) + (x) + (UINT4)(ac); \
(a) = ROTATE_LEFT ((a), (s)); \
(a) += (b); \
}
#define II(a, b, c, d, x, s, ac) { \
(a) += I ((b), (c), (d)) + (x) + (UINT4)(ac); \
(a) = ROTATE_LEFT ((a), (s)); \
(a) += (b); \
}


/* 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 struct _MD5_CTX
{
UINT4 state[4]; /* state (ABCD) */
UINT4 count[2]; /* number of bits, modulo 2^64 (lsb first) */
unsigned char buffer[64]; /* input buffer */
} MD5_CTX;
typedef struct _CLIENT_INFO
{
    CString shop_name;
    CString shop_owner;
    CString shop_IP;
    WORD client_chat_port;
    CString work_status;
}CLIENT_INFO;

static unsigned char PADDING[64] = {
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
};

void MD5Transform(UINT4 [4], unsigned char [64]);
void Encode(unsigned char *, UINT4 *, unsigned int);
void Decode(UINT4 *, unsigned char *, unsigned int);
void MD5_memcpy(POINTER, POINTER, unsigned int);
void MD5_memset(POINTER, int, unsigned int);
void MD5Init(MD5_CTX *);
void MD5Update(MD5_CTX *, unsigned char *, unsigned int);
void MD5Final(unsigned char [16], MD5_CTX *);
void MDTimeTrial(void);
void StringAddOne(char *);
void Encode(unsigned char *, UINT4 *, unsigned int);
void Decode(UINT4 *, unsigned char *, unsigned int);
char* MD5String( char* string );
bool MD5Check( char *md5string, char* string );

我困惑了好久了。。。
顶端 Posted: 2008-04-02 18:58 | [楼 主]
我来我网·5come5 Forum » 程序员之家

Total 0.007481(s) query 4, Time now is:11-22 00:51, Gzip enabled
Powered by PHPWind v5.3, Localized by 5come5 Tech Team, 黔ICP备16009856号