• Source
    1. #include <stdio.h>
    2. #include <inttypes.h>
    3.  
    4. #include "stdint.h" /* Replace with <stdint.h> if appropriate */
    5. #undef get16bits
    6. #if (defined(__GNUC__) && defined(__i386__)) || defined(__WATCOMC__) \
    7.   || defined(_MSC_VER) || defined (__BORLANDC__) || defined (__TURBOC__)
    8. #define get16bits(d) (*((const uint16_t *) (d)))
    9. #endif
    10.  
    11. #if !defined (get16bits)
    12. #define get16bits(d) ((((uint32_t)(((const uint8_t *)(d))[1])) << 8)\
    13.   +(uint32_t)(((const uint8_t *)(d))[0]) )
    14. #endif
    15.  
    16. uint32_t SuperFastHash (const char * data, int len) {
    17. uint32_t hash = len, tmp;
    18. int rem;
    19.  
    20. if (len <= 0 || data == NULL) return 0;
    21.  
    22. rem = len & 3;
    23. len >>= 2;
    24.  
    25. /* Main loop */
    26. for (;len > 0; len--) {
    27. hash += get16bits (data);
    28. tmp = (get16bits (data+2) << 11) ^ hash;
    29. hash = (hash << 16) ^ tmp;
    30. data += 2*sizeof (uint16_t);
    31. hash += hash >> 11;
    32. }
    33.  
    34. /* Handle end cases */
    35. switch (rem) {
    36. case 3: hash += get16bits (data);
    37. hash ^= hash << 16;
    38. hash ^= ((signed char)data[sizeof (uint16_t)]) << 18;
    39. hash += hash >> 11;
    40. break;
    41. case 2: hash += get16bits (data);
    42. hash ^= hash << 11;
    43. hash += hash >> 17;
    44. break;
    45. case 1: hash += (signed char)*data;
    46. hash ^= hash << 10;
    47. hash += hash >> 1;
    48. }
    49.  
    50. /* Force "avalanching" of final 127 bits */
    51. hash ^= hash << 3;
    52. hash += hash >> 5;
    53. hash ^= hash << 4;
    54. hash += hash >> 17;
    55. hash ^= hash << 25;
    56. hash += hash >> 6;
    57.  
    58. return hash;
    59. }
    60.  
    61. int main(void) {
    62. //char arr[3][100] = {"2cb2db96-3bd0-403e-abe2-9269b3761041.Bubble",
    63. // "9ce3c9c2-462f-4cc9-bbd7-57d656445be0.Bubble", "9ce3c9c2-462f-4cc9-bbd7-57d656445be0.Dot"};
    64. //char chunk[] = "Microsoft.Global.OnRamp_ImportUpsell";
    65. //uint32_t hash = SuperFastHash(chunk, strlen(chunk));
    66. //printf("%d\n", hash);
    67. char ids[30][100]={"cd4688a9-e888-48ea-ad81-76193d56b1be.Bubble", "cd4688a9-e888-48ea-ad81-76193d56b1be.IsKnowledgeCardQuery.Bubble", "cd4688a9-e888-48ea-ad81-76193d56b1be.IsTwitchNonStreamPage.Bubble","cd4688a9-e888-48ea-ad81-76193d56b1be.IsTwitchSubPage.Bubble","cd4688a9-e888-48ea-ad81-76193d56b1be.IsTextPage.Bubble","cd4688a9-e888-48ea-ad81-76193d56b1be.IsVideoPage.Bubble","cd4688a9-e888-48ea-ad81-76193d56b1be.IsMsnArticleUrlFromNtpP1P2.Bubble","c8ebd871-9f47-4a0d-abd3-c1c02b4f8f53.AutoOpen","c8ebd871-9f47-4a0d-abd3-c1c02b4f8f53.2cfab14c-ebd6-4548-9401-30ab5afe5061.AutoOpen","cd4688a9-e888-48ea-ad81-76193d56b1be.AutoOpen.PersistentChat","cd4688a9-e888-48ea-ad81-76193d56b1be.AutoOpen.PDF","SAN.Personalization.ConsentPrompt","PerformanceDetectorFeatureNotification","VPNFeatureNotification", "EdgeDownloadChromeInterceptDialog","ShorelinePrivilegedExperienceID","8682d0fa-50b3-4ece-aa5b-e0b33f9919e2.f5b8c725-cb2e-4c12-accd-73e500d88d47.AutoOpen","bc25fcef-8964-4e72-8287-23e2b496c128.68b8a884-6e08-46e6-8a3b-7e06ffe48ecf.AutoOpen"};
    68. for (int i = 0; i < 30; i++)
    69. {
    70. // printf("%d\n", strlen(ids[i]));
    71. int hash = SuperFastHash(ids[i], strlen(ids[i]));
    72. printf("%d\n", hash);
    73. }
    74. return 0;
    75. }
    76.