crchash.h 769 B

1234567891011121314151617181920212223242526
  1. /*
  2. ** Copyright (C) 2014 Wang Yaofu
  3. ** All rights reserved.
  4. **
  5. **Author:Wang Yaofu voipman@qq.com
  6. **Description: The header file of class CrcHash.
  7. */
  8. #ifndef _COMMON_CRC_CRCHASH_H_
  9. #define _COMMON_CRC_CRCHASH_H_
  10. #include <string>
  11. #include <stdint.h>
  12. namespace common {
  13. // string => 0x0000-0xffff
  14. uint16_t Hash16(const std::string& key);
  15. uint16_t Hash16(const char* cpKey, const int iKeyLen);
  16. // string => 0x00000000-0xffffffff
  17. uint32_t Hash32(const std::string& key);
  18. uint32_t Hash32(const char* cpKey, const int iKeyLen);
  19. // string => 0x0000000000000000-0xffffffffffffffff
  20. uint64_t Hash64(const std::string& key);
  21. uint64_t Hash64(const char* cpKey, const int iKeyLen);
  22. } // namespace common
  23. #endif // _COMMON_CRC_CRCHASH_H_