诸暨麻将添加redis
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

52 lines
1.5 KiB

  1. #ifndef WH_ENCRYPT_HEAD_FILE
  2. #define WH_ENCRYPT_HEAD_FILE
  3. #pragma once
  4. #include "ServiceCoreHead.h"
  5. #include <string>
  6. //////////////////////////////////////////////////////////////////////////////////
  7. //宏定义
  8. #define XOR_TIMES 8 //加密倍数
  9. #define MAX_SOURCE_LEN 64 //最大长度
  10. #define MAX_ENCRYPT_LEN (MAX_SOURCE_LEN*XOR_TIMES) //最大长度
  11. //////////////////////////////////////////////////////////////////////////////////
  12. //加密组件
  13. class SERVICE_CORE_CLASS CWHEncrypt
  14. {
  15. //函数定义
  16. public:
  17. //构造函数
  18. CWHEncrypt();
  19. //析构函数
  20. virtual ~CWHEncrypt();
  21. //加密函数
  22. public:
  23. //生成密文
  24. static bool MD5Encrypt(LPCTSTR pszSourceData, TCHAR szMD5Result[LEN_MD5]);
  25. static const char HEX[16];
  26. static std::string bytesToHexString(const byte* input, size_t length);
  27. static bool MD5Encrypt(LPCSTR pszSourceData, TCHAR szMD5Result[LEN_MD5]);
  28. //加密函数
  29. public:
  30. //生成密文
  31. static bool XorEncrypt(LPCTSTR pszSourceData, LPTSTR pszEncrypData, WORD wMaxCount);
  32. //解开密文
  33. static bool XorCrevasse(LPCTSTR pszEncrypData, LPTSTR pszSourceData, WORD wMaxCount);
  34. //加密函数
  35. public:
  36. //生成密文
  37. static bool MapEncrypt(LPCTSTR pszSourceData, LPTSTR pszEncrypData, WORD wMaxCount);
  38. //解开密文
  39. static bool MapCrevasse(LPCTSTR pszEncrypData, LPTSTR pszSourceData, WORD wMaxCount);
  40. };
  41. //////////////////////////////////////////////////////////////////////////////////
  42. #endif