uvAuth21.h 940 B

12345678910111213141516171819202122232425262728293031323334
  1. #pragma once
  2. #include <stdio.h>
  3. #include "../replicant\foundation\win-x86\types.h"
  4. #include <string>
  5. #include <string.h>
  6. #include <iostream>
  7. #include <sstream>
  8. #include <vector>
  9. #include <iomanip>
  10. #include <assert.h>
  11. #define XTEA_KEY_PAD 0
  12. #define XTEA_DATA_PAD 0
  13. #define __uint32 uint32_t
  14. #define __uint8 uint8_t
  15. using namespace std;
  16. class uvAuth21 {
  17. public:
  18. uvAuth21(void);
  19. string encrypt(string user, string password, string key);
  20. const char * encrypt(char * user,char * password,char * key);
  21. ~uvAuth21(void);
  22. private:
  23. protected:
  24. static void XTEA_encipher(__uint32* v, __uint32* k);
  25. static __uint32 fourCharsToLong(__uint8 *s);
  26. static string XTEA_encipher(const __uint8* c_data, size_t c_data_cnt, const __uint8* c_key, size_t c_key_cnt);
  27. static std::vector<std::string> dosplit(const std::string &s, char delim);
  28. static std::vector<std::string> &split(const std::string &s, char delim, std::vector<std::string> &elems);
  29. };