Skip to content

Commit c425d5f

Browse files
authored
Add files via upload
0 parents  commit c425d5f

21 files changed

+1990
-0
lines changed

Authorize.h

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#ifndef _IOS_AUTH_RUNTIME_AUTHORIZE_H_
2+
#define _IOS_AUTH_RUNTIME_AUTHORIZE_H_
3+
4+
#include "Header.h"
5+
#include "Client.h"
6+
#include "Convert.h"
7+
#include "Exec.h"
8+
#include "Handle.h"
9+
#include "Library.h"
10+
#include "Network.h"
11+
#include "Process.h"
12+
13+
#endif

Client.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
#include "Client.h"

Client.h

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#ifndef _IOS_AUTH_RUNTIME_CLIENT_H_
2+
#define _IOS_AUTH_RUNTIME_CLIENT_H_
3+
4+
#include "Header.h"
5+
6+
#endif

Convert.cpp

+61
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
#include "Convert.h"
2+
3+
4+
5+
// 转换字符数组至HEX
6+
IOS_AUTH_RUNTIME_API std::string auth_convert_bytes_to_hex(const void* _Bytes, size_t _Size) noexcept
7+
{
8+
if(_Bytes == nullptr || _Size == 0)
9+
{
10+
return {};
11+
}
12+
13+
auto vBuffer = (const char*)_Bytes;
14+
auto vConvert = std::string();
15+
char vHex[3] = { 0 };
16+
for(auto vIndex = 0U; vIndex < _Size; ++vIndex)
17+
{
18+
std::sprintf(vHex, "%02X", (uint8_t)vBuffer[vIndex]);
19+
vConvert.push_back(vHex[0]);
20+
vConvert.push_back(vHex[1]);
21+
}
22+
return vConvert;
23+
}
24+
25+
// 转换HEX至字符
26+
IOS_AUTH_RUNTIME_API char auth_convert_hex_to_char(char _Hex) noexcept
27+
{
28+
if((_Hex >= 'A') && (_Hex <= 'Z'))
29+
{
30+
return (char)(_Hex - 'A' + 10);
31+
}
32+
else if((_Hex >= 'a') && (_Hex <= 'z'))
33+
{
34+
return (char)(_Hex - 'a' + 10);
35+
}
36+
else if((_Hex >= '0') && (_Hex <= '9'))
37+
{
38+
return (char)(_Hex - '0');
39+
}
40+
return 0;
41+
}
42+
43+
// 转换HEX至字符数组
44+
IOS_AUTH_RUNTIME_API std::string auth_convert_hex_to_bytes(const void* _Hex, size_t _Size) noexcept
45+
{
46+
if(_Hex == nullptr || _Size <= 1)
47+
{
48+
return {};
49+
}
50+
51+
auto vBuffer = (const char*)_Hex;
52+
auto vConvert = std::string();
53+
for(auto vIndex = 0U; vIndex < _Size - 1; vIndex += 2)
54+
{
55+
auto vHexL = auth_convert_hex_to_char(vBuffer[vIndex + 0]);
56+
auto vHexR = auth_convert_hex_to_char(vBuffer[vIndex + 1]);
57+
auto vChar = static_cast<char>(vHexL * 16 + vHexR);
58+
vConvert.push_back(vChar);
59+
}
60+
return vConvert;
61+
}

Convert.h

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#ifndef _IOS_AUTH_RUNTIME_CONVERT_H_
2+
#define _IOS_AUTH_RUNTIME_CONVERT_H_
3+
4+
#include "Header.h"
5+
6+
7+
// 转换字符数组至HEX
8+
IOS_AUTH_RUNTIME_API std::string auth_convert_bytes_to_hex(const void* _Bytes, size_t _Size) noexcept;
9+
10+
// 转换HEX至字符
11+
IOS_AUTH_RUNTIME_API char auth_convert_hex_to_char(char _Hex) noexcept;
12+
13+
// 转换HEX至字符数组
14+
IOS_AUTH_RUNTIME_API std::string auth_convert_hex_to_bytes(const void* _Hex, size_t _Size) noexcept;
15+
16+
17+
#endif

0 commit comments

Comments
 (0)