相关疑难解决方法(0)

是否可以转换参数包中的类型?

是否可以转换参数包的类型并将其传递?

例如,给出以下内容:

template<class... Args> struct X {};
template<class T> struct make_pointer     { typedef T* type; };
template<class T> struct make_pointer<T*> { typedef T* type; };
Run Code Online (Sandbox Code Playgroud)

我们可以定义模板magic或类似的东西,以便以下断言成立:

typedef magic<X, make_pointer, int, char>::type A;
typedef X<int*, char*> B;
static_assert(is_same<A, B>::value, ":(");
Run Code Online (Sandbox Code Playgroud)

c++ templates metaprogramming c++11

14
推荐指数
1
解决办法
1718
查看次数

编译时字符串加密

我不希望逆向工程师在我的应用程序中读取硬编码字符串的纯文本.对此的简单解决方案是使用简单的XOR加密.问题是我需要一个转换器,在我的应用程序中它将如下所示:

//Before (unsecure)
char * cString = "Helllo Stackoverflow!";
//After (secure)
char * cString = XStr( 0x06, 0x15, 0x9D, 0xD5FBF3CC, 0xCDCD83F7, 0xD1C7C4C3, 0xC6DCCEDE, 0xCBC2C0C7, 0x90000000 ).c();
Run Code Online (Sandbox Code Playgroud)

是否有可能通过使用某些结构来维护干净的代码

//Before (unsecure)
char * cString = "Helllo Stackoverflow!";
//After (secure)
char * cString = CRYPT("Helllo Stackoverflow!");
Run Code Online (Sandbox Code Playgroud)

它也适用于很长的字符串(1000个字符?:-)).先感谢您

c++ encryption macros reverse-engineering

13
推荐指数
4
解决办法
1万
查看次数