Chinaunix
标题:
大家帮看看,问题出在那里!在x86下没有问题,换个系统就失败了
[打印本页]
作者:
zw2002
时间:
2006-08-15 13:45
标题:
大家帮看看,问题出在那里!在x86下没有问题,换个系统就失败了
int nMoveBits;
char challenge[32];
long challengetime_new;
int nMoveBits;
long challengetime;
if (get_reply(sock, buf) != 0) goto restart;
len = Decode(buf + 4,challenge,strlen(buf) - 4);//解码
challengetime = *((unsigned long*)(challenge + 6));
challengetime |= ~0X1d8b3150;
nMoveBits = challengetime % 30;
challengetime_new = (challengetime << (32 - nMoveBits)) | ((challengetime >> nMoveBits) & ~(0xffffffff << (32 - nMoveBits)));
unsigned char digest[16];
hmac((unsigned char *)"zw2002", strlen("zw2002"), challenge, len, digest);//加密
unsigned char temp[128];
strcpy((char*)temp,"zw2002");
strcat((char*)temp," ");
len = strlen((const char *)temp);
memcpy(temp + len,&challengetime_new,4);
len += 4;
memcpy(temp + len,&(clientinfo),4);
len += 4;
memcpy(temp + len,digest,16);
len += 16;
len = encode(temp,len,buf);//加密
buf[len] = 0;
strcat(buf,"\r\n");
len += 2;
LOGMSG("%s\n", buf);
if (send_request(sock, buf) != 0) goto restart;
复制代码
在那里进行大小端转换?怎么去转换呢?
[
本帖最后由 zw2002 于 2006-8-15 14:04 编辑
]
作者:
zw2002
时间:
2006-08-15 14:09
标题:
回复 1楼 zw2002 的帖子
太难了,没人回啊?
欢迎光临 Chinaunix (http://bbs.chinaunix.net/)
Powered by Discuz! X3.2