// ConsoleApplication8.cpp : 此文件包含 "main" 函数。程序执行将在此处开始并结束。
// 很多头文件不需要,你自己看着用吧 我是复制我之前的
#include "pch.h"
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
/// 字符转字节
int ctoh(char hex)
{
if (hex >= '0' && hex <= '9') return hex - '0';
if (hex >= 'A' && hex <= 'F') return hex - 'A' + 10;
if (hex >= 'a' && hex <= 'f') return hex - 'a' + 10;
return 0;
}
/// 十六进制字符串转字节数组
std::vector HexStringToBytes(std::string str)
{
std::vector Bytes;
for (SIZE_T i = 0; i < str.size(); i++)
{
if (str[i] == ' ')
{
continue;
}
if (str[i] == '?')
{
Bytes.insert(Bytes.end(), '?');
// 兼容OD模式的特征码
if (str[i+1] == '?')
i++;
}
else if (str[i] == '*') {
Bytes.insert(Bytes.end(), '*');
}
else {
Bytes.insert(Bytes.end(), 0x10 * ctoh(str[i]) + ctoh(str[i + 1]));