fork download
  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[50][100]={"2cb2db96-3bd0-403e-abe2-9269b3761041.AutoOpen", "439642fc-998d-4a64-8bb6-940ecaf6b60b.AutoOpen", "64be4f9b-3b81-4b6e-b354-0ba00d6ba485.AutoOpen","8ac719c5-140b-4bf2-a0b7-c71617f1f377.AutoOpen","8ac719c5-140b-4bf2-a0b7-c71617f1f377.gaokao.Bubble","8ac719c5-140b-4bf2-a0b7-c71617f1f377.3662f1e2-66ae-464f-b690-e7e3dc4fc662.AutoOpen","96defd79-4015-4a32-bd09-794ff72183ef.AutoOpen","96defd79-4015-4a32-bd09-794ff72183ef.128c39c6-6f70-4ce5-9d01-78978e60d666.AutoOpen","96defd79-4015-4a32-bd09-794ff72183ef.0bdde3c3-7be8-49f1-971b-e6e2cfd62643.AutoOpen","96defd79-4015-4a32-bd09-794ff72183ef.5ac63306-e962-42e6-8313-7e5a5b707d65.AutoOpen","8ac719c5-140b-4bf2-a0b7-c71617f1f377.93e5b5cd-15fc-4253-9728-d80685da304e.AutoOpen","cd4688a9-e888-48ea-ad81-76193d56b1be.AutoOpen","cd4688a9-e888-48ea-ad81-76193d56b1be.8d3a928d-e911-40f0-9852-f63f6434dc7e.AutoOpen","cd4688a9-e888-48ea-ad81-76193d56b1be.e06e75c1-a59a-4ab6-8361-e8b038e00a8c.AutoOpen","cd4688a9-e888-48ea-ad81-76193d56b1be.5b853177-a0be-4237-bda0-4fce5cd165c2.AutoOpen","b7a8e9f2-6b0d-4c5b-ae7d-8a6e1f2c7a6f.AutoOpen","b7a8e9f2-6b0d-4c5b-ae7d-8a6e1f2c7a6f.c8ebbf64-e3b8-41d9-925f-4e3754151ff7.AutoOpen","b7a8e9f2-6b0d-4c5b-ae7d-8a6e1f2c7a6f.75a774c2-6075-ae4f-09f9-e5f5d9bef6e1.AutoOpen","b7a8e9f2-6b0d-4c5b-ae7d-8a6e1f2c7a6f.a5e9f5e1-fcee-c07b-2c44-b707ded020a3.AutoOpen","2cb2db96-3bd0-403e-abe2-9269b3761041.Bubble","9ce3c9c2-462f-4cc9-bbd7-57d656445be0.Bubble","96defd79-4015-4a32-bd09-794ff72183ef.Bubble","96defd79-4015-4a32-bd09-794ff72183ef.Is1PGameDomain.Bubble","96defd79-4015-4a32-bd09-794ff72183ef.Is3PGameDomain.Bubble","64be4f9b-3b81-4b6e-b354-0ba00d6ba485.Bubble","8682d0fa-50b3-4ece-aa5b-e0b33f9919e2.Bubble","523b5ef3-0b10-4154-8b62-10b2ebd00921.Bubble","21f3388b-c2a5-4791-8f6e-a4cad6d17f4f.Bubble","439642fc-998d-4a64-8bb6-940ecaf6b60b.Bubble",
  68. "92f1b743-e26b-433b-a1ec-912d1f0ad1fa.Bubble","bc25fcef-8964-4e72-8287-23e2b496c128.Bubble","76b926d6-3738-46bf-82d7-2ab896ddf70b.MM2UpSellPopup.Bubble","e6723537-66ff-4f4e-ab56-a4cbaddf4e0f.MM2UpSellPopup.Bubble","2354565a-f412-4654-b89c-f92eaa9dbd20.Travel.Bubble","2354565a-f412-4654-b89c-f92eaa9dbd20.Jobs.Bubble","2354565a-f412-4654-b89c-f92eaa9dbd20.Weather.Bubble","2354565a-f412-4654-b89c-f92eaa9dbd20.KnowledgeCard.Bubble","2354565a-f412-4654-b89c-f92eaa9dbd20.Recipe.Bubble","2354565a-f412-4654-b89c-f92eaa9dbd20.Local.Bubble","2354565a-f412-4654-b89c-f92eaa9dbd20.SearchPage.Bubble","2354565a-f412-4654-b89c-f92eaa9dbd20.BingHomePage.Bubble","2354565a-f412-4654-b89c-f92eaa9dbd20.NTP3PCLICK.Bubble","2354565a-f412-4654-b89c-f92eaa9dbd20.Finance.Bubble","2354565a-f412-4654-b89c-f92eaa9dbd20.Covid.Bubble","2354565a-f412-4654-b89c-f92eaa9dbd20.Sports.Bubble","2354565a-f412-4654-b89c-f92eaa9dbd20.NotifySearchPage.Bubble","cd4688a9-e888-48ea-ad81-76193d56b1be.Bubble","cd4688a9-e888-48ea-ad81-76193d56b1be.IsKnowledgeCardQuery.Bubble","cd4688a9-e888-48ea-ad81-76193d56b1be.IsTwitchNonStreamPage.Bubble",
  69. "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","cd4688a9-e888-48ea-ad81-76193d56b1be.IsCompeteAISite.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"
  70. };
  71. for (int i = 0; i < 50; i++)
  72. {
  73. // printf("%d\n", strlen(ids[i]));
  74. uint32_t hash = SuperFastHash(ids[i], strlen(ids[i]));
  75. printf("%d\n", hash);
  76. }
  77. return 0;
  78. }
  79.  
Success #stdin #stdout 0.01s 5124KB
stdin
Standard input is empty
stdout
-287301633
1599212959
821117279
1455509297
838750066
-511248645
-1920009432
-438812552
294196679
-1017785080
1651396435
1593063524
-55855655
194064058
1899511698
-2136679689
1756816373
-183054178
-932483773
-1713711773
1671511582
1948518588
1333487575
-1065401753
1858481548
-585257549
706038642
395770946
998143471
-277598447
826588517
1267911943
191292926
-1523120288
1074233843
1242253909
1581581989
279979505
-867971708
1877438589
1272456728
-1728308017
-1747601969
77904809
1306838224
1957321297
283890568
-1045551688
1934839566
-1579946587