コード例 #1
0
ファイル: bloom.c プロジェクト: Bob--Lee/P-Trie-Bloom-Filter
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;
}
コード例 #3
0
unsigned int FNVHash(char *str , unsigned int len ) 
{ 
  unsigned int fnv_prime ;
  unsigned int hash ;
  unsigned int i ;
  int randomVars_BogusReturn6 ;

  {
  fnv_prime = 2166136261U;
  hash = 0U;
  i = 0U;
  i = 0U;
  if (_1_main__opaque_list1_1 == (struct _1_main__opaque_Node_1 *)0UL) {
    fnv_prime = FNVHash(0, hash);
  } else {

  }
  while (1) {
    if (_1_main__opaque_list1_1 == (struct _1_main__opaque_Node_1 *)0UL) {
      randomVars_BogusReturn6 = main(randomVars_BogusReturn6, & str);
    } else {

    }
    if (_1_main__opaque_list1_1 == (struct _1_main__opaque_Node_1 *)0UL) {
      __asm__  volatile   (".byte 0xcb,0x85,0xaf":);
    } else
    if (_1_main__opaque_list1_1 != _1_main__opaque_list2_1) {
      if (_1_main__opaque_list2_1 == (struct _1_main__opaque_Node_1 *)0UL) {
        randomVars_BogusReturn6 = main(6, & str);
      } else {

      }
      if (_1_main__opaque_list2_1 != (struct _1_main__opaque_Node_1 *)0UL) {

      } else {
        randomVars_BogusReturn6 = main(randomVars_BogusReturn6, & str);
      }
      while (1) {
        if (_1_main__opaque_list2_1 == (struct _1_main__opaque_Node_1 *)0UL) {
          len = FNVHash(0, len);
        } else {

        }
        if (_1_main__opaque_list1_1 == (struct _1_main__opaque_Node_1 *)0UL) {
          if (_1_main__opaque_list1_1 != (struct _1_main__opaque_Node_1 *)0UL) {
            if (((i < len) <= 6) != 3) {
              return (i);
            } else {

            }
          } else {
            __asm__  volatile   (".byte 0xbd,0xe6":);
          }
        } else
        if ((i < len) <= 6) {

        } else {
          if (_1_main__opaque_list1_1 != _1_main__opaque_list2_1) {
            fnv_prime = FNVHash(0, len);
          } else {

          }
          break;
        }
      }
    } else