xxhash64-php.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #define FFI_LIB "libxxhash.so"
  2. typedef enum { XXH_OK=0, XXH_ERROR } XXH_errorcode;
  3. typedef uint32_t XXH32_hash_t;
  4. typedef uint64_t XXH64_hash_t;
  5. struct XXH3_state_s {
  6. XXH64_hash_t acc[8];
  7. unsigned char customSecret[192]; /* used to store a custom secret generated from the seed. Makes state larger. Design might change */
  8. unsigned char buffer[256];
  9. XXH32_hash_t bufferedSize;
  10. XXH32_hash_t nbStripesPerBlock;
  11. XXH32_hash_t nbStripesSoFar;
  12. XXH32_hash_t secretLimit;
  13. XXH32_hash_t reserved32;
  14. XXH32_hash_t reserved32_2;
  15. XXH64_hash_t totalLen;
  16. XXH64_hash_t seed;
  17. XXH64_hash_t reserved64;
  18. const unsigned char* secret; /* note : there is some padding after, due to alignment on 64 bytes */
  19. }; /* typedef'd to XXH3_state_t */
  20. typedef struct XXH3_state_s XXH3_state_t;
  21. extern XXH3_state_t* XXH3_createState(void);
  22. extern XXH_errorcode XXH3_freeState(XXH3_state_t* statePtr);
  23. extern XXH64_hash_t XXH3_64bits(const void* data, size_t len);
  24. extern XXH64_hash_t XXH3_64bits_withSeed(const void* data, size_t len, XXH64_hash_t seed);
  25. extern XXH64_hash_t XXH3_64bits_withSecret(const void* data, size_t len, const void* secret, size_t secretSize);
  26. extern XXH_errorcode XXH3_64bits_reset(XXH3_state_t* statePtr);
  27. extern XXH_errorcode XXH3_64bits_reset_withSeed(XXH3_state_t* statePtr, XXH64_hash_t seed);
  28. extern XXH_errorcode XXH3_64bits_reset_withSecret(XXH3_state_t* statePtr, const void* secret, size_t secretSize);
  29. extern XXH_errorcode XXH3_64bits_update (XXH3_state_t* statePtr, const void* input, size_t length);
  30. extern XXH64_hash_t XXH3_64bits_digest (const XXH3_state_t* statePtr);
  31. typedef struct { unsigned char digest[8]; } XXH64_canonical_t;
  32. extern void XXH64_canonicalFromHash(XXH64_canonical_t* dst, XXH64_hash_t hash);
  33. extern XXH64_hash_t XXH64_hashFromCanonical(const XXH64_canonical_t* src);