|
发表于 2010-9-21 14:46:33
|
显示全部楼层
checksum由两部分组成,一个是异或校验(参考下面的算法),另一个是SHA-1(123后才有的)。
参与计算的文件是w3*系列文件,war3map.j和BJ、CJ文件。基本上就是这样了吧。
- #define LONG(c) (*(DWORD*)(&(c)))
- #define ROTL(x,n) (((x)<<(n))|((x)>>(32-(n))))
- DWORD XORRotateLeft(const BYTE* data, DWORD length)
- {
- DWORD hash = 0L;
- if (data == NULL) return 0L;
- while(length > 3)
- {
- hash = ROTL(hash ^ LONG(*data), 3);
- data += 4;
- length -= 4;
- }
- while(length-- > 0)
- {
- hash = ROTL(hash ^ (*data), 3);
- data++;
- }
- return hash;
- }
复制代码 |
|