Advertisement
Guest User

idResourceId 0.3 by infogram

a guest
Apr 1st, 2020
223
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.28 KB | None | 0 0
  1. // idResourceId 0.3 by infogram
  2. // Requires farmhash.cc & farmhash.h, and define FARMHASH_NO_BUILTIN_EXPECT in project properties
  3. // (needs one small modification to farmhash.cc: change farmhashxo::Hash64 to make it call farmhashna::Hash64 no matter what size)
  4.  
  5. #include <iostream>
  6.  
  7. #define WIN32_LEAN_AND_MEAN
  8. #include <Windows.h>
  9.  
  10. #include "farmhash.h"
  11.  
  12. int main(int argc, char* argv[])
  13. {
  14. printf("idResourceId 0.3 by infogram\n\n");
  15.  
  16. if (argc < 2)
  17. {
  18. printf("usage: idResId.exe <resource/path> [resource-type]\n");
  19. printf("if resource-type isn't set, will use warehouseItem\n");
  20. return 1;
  21. }
  22.  
  23. const char* resourceType = "warehouseItem";
  24. if (argc > 2)
  25. resourceType = argv[2];
  26.  
  27. const char* resourcePath = argv[1];
  28.  
  29. printf("Path: %s\n", resourcePath);
  30. printf("Type: %s\n\n", resourceType);
  31.  
  32. util::uint128_t hash;
  33.  
  34. // requires a small change to farmhashxo::Hash64, to make it call farmhashna::Hash64 no matter what size
  35. hash.second = util::Hash64(resourcePath, strlen(resourcePath));
  36. hash.first = util::Hash64(resourceType, strlen(resourceType));
  37.  
  38. printf("Hash1: %llu\n", hash.first);
  39. printf("Hash2: %llu\n\n", hash.second);
  40.  
  41. auto finalHash = util::Fingerprint(hash);
  42.  
  43. printf("Result: %llu\n", finalHash);
  44. return 0;
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement