Chinaunix

标题: 大家帮看看,问题出在那里!在x86下没有问题,换个系统就失败了 [打印本页]

作者: zw2002    时间: 2006-08-15 13:45
标题: 大家帮看看,问题出在那里!在x86下没有问题,换个系统就失败了

  1.         int nMoveBits;
  2.         char challenge[32];
  3.     long challengetime_new;
  4.     int nMoveBits;
  5.     long challengetime;


  6.     if (get_reply(sock, buf) != 0) goto restart;
  7.        
  8.         len = Decode(buf + 4,challenge,strlen(buf) - 4);//解码
  9.     challengetime = *((unsigned long*)(challenge + 6));
  10.        
  11.         challengetime |= ~0X1d8b3150;
  12.     nMoveBits = challengetime % 30;
  13.     challengetime_new = (challengetime << (32 - nMoveBits)) | ((challengetime >> nMoveBits) & ~(0xffffffff << (32 - nMoveBits)));

  14.     unsigned char digest[16];
  15.     hmac((unsigned char *)"zw2002", strlen("zw2002"), challenge, len, digest);//加密

  16.     unsigned char temp[128];
  17.     strcpy((char*)temp,"zw2002");
  18.     strcat((char*)temp," ");

  19.     len = strlen((const char *)temp);
  20.     memcpy(temp + len,&challengetime_new,4);
  21.     len += 4;
  22.        
  23.         memcpy(temp + len,&(clientinfo),4);
  24.     len += 4;
  25.     memcpy(temp + len,digest,16);

  26.     len += 16;
  27.     len = encode(temp,len,buf);//加密
  28.     buf[len] = 0;
  29.     strcat(buf,"\r\n");
  30.     len += 2;
  31.     LOGMSG("%s\n", buf);

  32.         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