예제 #1
0
int bloom_check(BLOOM *bloom,char *s){

	unsigned int k = 0;
	unsigned int b = 0;
	unsigned int len = strlen(s);
	for(k=0;k<11;k++) {
		switch(k) {
			case 0: b=RSHash(s,len);
			 		break;
			case 1: b=JSHash(s,len);
					break;
			case 2: b=PJWHash(s,len);
					break;
			case 3: b=ELFHash(s,len);
					break;
			case 4: b=BKDRHash(s,len);
					break;
			case 5: b=SDBMHash(s,len);
					break;
			case 6: b=DJBHash(s,len);
					break;
			case 7: b=DEKHash(s,len);
					break;
			case 8: b=BPHash(s,len);
					break;
			case 9: b=FNVHash(s,len);
					break;
			case 10: b=APHash(s,len);
					break;
		}
		if(!GETBIT(bloom->a,b%bloom->size))
			return 0;
	}
	return 1;
}
예제 #2
0
파일: HashTest.c 프로젝트: ArashPartow/hash
int main(int argc, char* argv[])
{
   char* key = "abcdefghijklmnopqrstuvwxyz1234567890";

   printf("General Purpose Hash Function Algorithms Test\n");
   printf("By Arash Partow - 2002          \n"                 );
   printf("Key:                          %s\n",key             );
   printf(" 1. RS-Hash Function Value:   %u\n",RSHash  (key,36));
   printf(" 2. JS-Hash Function Value:   %u\n",JSHash  (key,36));
   printf(" 3. PJW-Hash Function Value:  %u\n",PJWHash (key,36));
   printf(" 4. ELF-Hash Function Value:  %u\n",ELFHash (key,36));
   printf(" 5. BKDR-Hash Function Value: %u\n",BKDRHash(key,36));
   printf(" 6. SDBM-Hash Function Value: %u\n",SDBMHash(key,36));
   printf(" 7. DJB-Hash Function Value:  %u\n",DJBHash (key,36));
   printf(" 8. DEK-Hash Function Value:  %u\n",DEKHash (key,36));
   printf(" 9. BP-Hash Function Value:   %u\n",BPHash  (key,36));
   printf("10. FNV-Hash Function Value:  %u\n",FNVHash (key,36));
   printf("11. AP-Hash Function Value:   %u\n",APHash  (key,36));

   return 1;
}