Blizzard Hash Algorithm

Source: Internet
Author: User
Tags blizzard

References: Inside MoPaQ chapter two

Applicable scenarios: There is a huge string array. If a string is given, it is determined whether it is in the string array;

Main Ideas:

 

Code Implementation:

 #include          unsigned  seed = , index1 = , index2 =        (index1 = ; index1 < ; index1++           (index2 = index1, i = ; i < ; i++, index2 +=               unsigned              seed = (seed *  + ) %              temp1 = (seed & ) <<              seed = (seed *  + ) %              temp2 = (seed &              cryptTable[index2] = (temp1 |              unsigned  HashString( *lpszString, unsigned       unsigned  *key = (unsigned  *     unsigned  seed1 = , seed2 =            (*key !=           ch = toupper(*key++          seed1 = cryptTable[(dwHashType << ) + ch] ^ (seed1 +         seed2 = ch + seed1 + seed2 + (seed2 << ) +                  unsigned  MPQHashTableInit( **ppHashTable,        i =       *p =     MPQHASHTABLE *_pHashTable =                p = malloc(nTableLength *       (p ==          printf(                *ppHashTable =     _pHashTable = (MPQHASHTABLE *               (i = ; i < nTableLength; i++          (_pHashTable + i)->nHashA = -         (_pHashTable + i)->nHashB = -         (_pHashTable + i)->bExists =                       MPQHashTableFree( *       (pHashTable !=           pHashTable =            unsigned  MPQHashTableAdd( *lpszString,  *       unsigned  HASH_OFFSET = , HASH_A = , HASH_B =      unsigned  nHash =     unsigned  nHashA =     unsigned  nHashB =     unsigned  nHashStart = nHash %     unsigned  nHashPos =     MPQHASHTABLE *_pHashTable = (MPQHASHTABLE *               ((_pHashTable + nHashPos)->          nHashPos = (nHashPos + ) %                   (nHashPos ==                           (_pHashTable + nHashPos)->nHashA =     (_pHashTable + nHashPos)->nHashB =     (_pHashTable + nHashPos)->bExists =                    MPQHashTableIsExist( *lpszString,  *       unsigned  HASH_OFFSET = , HASH_A = , HASH_B =      unsigned  nHash =     unsigned  nHashA =     unsigned  nHashB =     unsigned  nHashStart = nHash %     unsigned  nHashPos =     MPQHASHTABLE *_pHashTable = (MPQHASHTABLE *           ((_pHashTable + nHashPos)->           (((_pHashTable + nHashPos)->nHashA == nHashA) &&              ((_pHashTable + nHashPos)->nHashB ==                                      nHashPos = (nHashPos +) %           (nHashPos ==                      - }

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.