本文介绍了C++:如何在编译时加密字符串?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!
问题描述
我想在我的 .exe 中隐藏一些字符串,这样人们就不能简单地打开 .exe 并查看那里的所有字符串.我不关心加密方法的强度,所以我可能会使用 XOR 等.
I want to hide some strings in my .exe so people can't simply just open the .exe and look at all the strings there. I don't care about the strength of the encrypting method, so I will probably use XOR etc.
如何在编译时执行此操作?这样我的字符串就不会存储在 .exe 中,但加密版本会.然后,我每次都会使用我的解密功能在屏幕上显示这些字符串.
How can I do this at compile time? That way my strings won't be stored in the .exe but the encrypted versions would. Then, I would just use my decrypting function every time to display those strings on screen.
推荐答案
您可以使用宏对其进行加密或编写自己的预处理器
you can encrypt it using macros or write your own preprocessor
#define CRYPT8(str) { CRYPT8_(str " ") }
#define CRYPT8_(str) (str)[0] + 1, (str)[1] + 2, (str)[2] + 3, (str)[3] + 4, (str)[4] + 5, (str)[5] + 6, (str)[6] + 7, (str)[7] + 8, ' '
// calling it
const char str[] = CRYPT8("ntdll");
这篇关于C++:如何在编译时加密字符串?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!
The End


大气响应式网络建站服务公司织梦模板
高端大气html5设计公司网站源码
织梦dede网页模板下载素材销售下载站平台(带会员中心带筛选)
财税代理公司注册代理记账网站织梦模板(带手机端)
成人高考自考在职研究生教育机构网站源码(带手机端)
高端HTML5响应式企业集团通用类网站织梦模板(自适应手机端)