pycore_pyhash.h 709 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #ifndef Py_INTERNAL_HASH_H
  2. #define Py_INTERNAL_HASH_H
  3. #ifndef Py_BUILD_CORE
  4. # error "this header requires Py_BUILD_CORE define"
  5. #endif
  6. struct pyhash_runtime_state {
  7. struct {
  8. #ifndef MS_WINDOWS
  9. int fd;
  10. dev_t st_dev;
  11. ino_t st_ino;
  12. #else
  13. // This is a placeholder so the struct isn't empty on Windows.
  14. int _not_used;
  15. #endif
  16. } urandom_cache;
  17. };
  18. #ifndef MS_WINDOWS
  19. # define _py_urandom_cache_INIT \
  20. { \
  21. .fd = -1, \
  22. }
  23. #else
  24. # define _py_urandom_cache_INIT {0}
  25. #endif
  26. #define pyhash_state_INIT \
  27. { \
  28. .urandom_cache = _py_urandom_cache_INIT, \
  29. }
  30. uint64_t _Py_KeyedHash(uint64_t, const char *, Py_ssize_t);
  31. #endif // Py_INTERNAL_HASH_H