能力值:
(RANK:500 )
2 楼
UserName:kyo327
sn:067738D2RDBF5ED2A
能力值:
( LV12,RANK:779 )
3 楼
非常好。
:)
能力值:
( LV15,RANK:3306 )
4 楼
学习
fenjianren
60177878R8BB05B04
能力值:
( LV15,RANK:3306 )
5 楼
能力值:
( LV12,RANK:779 )
6 楼
// 好,002被解决了
// readyu's hash32bit_c_d algo
#define INIT_ROUND 1
//260 tables
static unsigned int hash_tbl[256+4] = {0};
unsigned int calc_hash32_c(unsigned int hash32_head, const void * buf, int lenth)
{
unsigned int hash32;
unsigned char * p = (unsigned char *)buf;
int j;
hash32 = hash32_head;
while(lenth --) {
hash32 ^= (*p << 0xC);
p++;
for(j = 0; j < 3; j++) {
hash32 += hash32;
hash32 ^= hash_tbl[(hash32>>0xC) & 0xFF];
}
}
return hash32;
}
unsigned int calc_hash32_d(unsigned int hash32_head, const void * buf, int lenth)
{
unsigned int hash32;
unsigned char * p = (unsigned char *)buf;
int j;
hash32 = hash32_head;
while(lenth --) {
hash32 ^= (*p << 0xD);
p++;
for(j = 0; j < 3 ; j++) {
hash32 += hash32;
hash32 ^= hash_tbl[(hash32>>0xD) & 0xFF];
}
}
return hash32;
}
// init hash table first, before you using hash-functions above
void init_hash_tbl_cd(int round)
{
int j, k;
if(round < 1 || round > 0xF) // so, I need 1<= round <= 0xF
round = INIT_ROUND;
for(j = 0; j <=0xFF ; j++) {
hash_tbl[j] = j << 24;
hash_tbl[j] |= j << 16;
hash_tbl[j] |= j << 8;
hash_tbl[j] |= j;
}
k = 0;
while(k++ < round) {
for(j = 0; j <=0xFF ; j++) {
hash_tbl[j] ^= calc_hash32_c(hash_tbl[j], &hash_tbl, j);
hash_tbl[j] ^= calc_hash32_d(hash_tbl[j], &hash_tbl, j);
}
for(j = 0; j <=0xFF ; j++) {
hash_tbl[j] ^= calc_hash32_d(hash_tbl[j], &hash_tbl, j);
hash_tbl[j] ^= calc_hash32_c(hash_tbl[j], &hash_tbl, j);
}
}
for(j = 0; j <=0xFF ; j++) {
hash_tbl[j] ^= calc_hash32_c(hash_tbl[j], &hash_tbl, 0xFF);
hash_tbl[j] ^= calc_hash32_d(hash_tbl[j], &hash_tbl, 0xFF);
}
#ifdef HASH_SHOW_MAGIC
for (j = 0; j <4 ; j++){
hash_tbl[256+j] = 0xEFBEFECA;
}
#endif
return;
}
能力值:
( LV9,RANK:1250 )
7 楼
[QUOTE=readyu;380607]// 好,002被解决了
// readyu's hash32bit_c_d algo
#define INIT_ROUND 1
//260 tables
static unsigned int hash_tbl[256+4] = {0};
unsigned int calc...[/QUOTE]
欢迎你开源。
能力值:
(RANK:300 )
8 楼
支持
能力值:
( LV2,RANK:10 )
9 楼
笨.没有算出来.
哈哈,学习