fasthash.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /* The MIT License
  2. Copyright (C) 2012 Zilong Tan (eric.zltan@gmail.com)
  3. Permission is hereby granted, free of charge, to any person
  4. obtaining a copy of this software and associated documentation
  5. files (the "Software"), to deal in the Software without
  6. restriction, including without limitation the rights to use, copy,
  7. modify, merge, publish, distribute, sublicense, and/or sell copies
  8. of the Software, and to permit persons to whom the Software is
  9. furnished to do so, subject to the following conditions:
  10. The above copyright notice and this permission notice shall be
  11. included in all copies or substantial portions of the Software.
  12. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  13. EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  14. MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  15. NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
  16. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
  17. ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  18. CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  19. SOFTWARE.
  20. */
  21. #ifndef _FASTHASH_H
  22. #define _FASTHASH_H
  23. #include <stdint.h>
  24. #include <stdio.h>
  25. #ifdef __cplusplus
  26. extern "C" {
  27. #endif
  28. /**
  29. * fasthash32 - 32-bit implementation of fasthash
  30. * @buf: data buffer
  31. * @len: data size
  32. * @seed: the seed
  33. */
  34. uint32_t fasthash32(const void *buf, size_t len, uint32_t seed);
  35. /**
  36. * fasthash64 - 64-bit implementation of fasthash
  37. * @buf: data buffer
  38. * @len: data size
  39. * @seed: the seed
  40. */
  41. uint64_t fasthash64(const void *buf, size_t len, uint64_t seed);
  42. #ifdef __cplusplus
  43. }
  44. #endif
  45. #endif