Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

annidy/obstr

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

7 Commits

Repository files navigation

Obstr

源代码中包含明文字符串,很容易通过静态反编译工具分析出来,strings工具也可以将其dump出来,非常不利于敏感文本保护。用加密文本代替明文,能有效阻止静态反编译工具分析,增加破解难度。

obstr就是这样一个简单加密C字符的小工具,它将字符串转换为加密数据,在运行时解密。

obstr并非一个十分"健壮"的加密算法,只是给破解增加一点点难度,请谨慎使用

使用方法

  1. obstr.h,obstr.c两个文件导入到您的工程
  2. 在本工程运行make命令,生成obdef辅助工具

举个例子,代码中有个字符串"hello"。先通过obdef生成加密宏定义

➜ obstr git:(master) ✗ ./obdef hello
/* hello */
static uint8_t obstr_3099[] = {0x08,0x3a,0x26,0x96,0x8c,0x63,0xe7,0x17};
#define O_hello ObstrDec(obstr_3099)

将输出内容拷贝到代码里,在要用"hello"的地方,用O_hello代替即可,就这么简单。

原理介绍

加密流程

加密方法选用简单快速的TEA,密钥默认{0x0, 0x0, 0x0, 0x0}。

举例来说,字符串"hello"加密后的结果为

h e l l o 0円
0x3a 0x26 0x96 0x8c 0x63 0xe7 0x17 0x49

加密后的密文不再以0円结尾,在密文前加上当前密文长度

8円 h e l l o 0円
0x08 0x3a 0x26 0x96 0x8c 0x63 0xe7 0x17 0x49

解密流程

解密流程相反,先通过异或解出密文长度,再通过TEA解密字符串。

解密后,下次使用时无需再重复解密。

About

字符串混淆工具

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

Contributors

AltStyle によって変換されたページ (->オリジナル) /