-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
121 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,21 @@ | ||
# 高级代码加固 | ||
|
||
高级代码加固是高级指令优化技术的衍生技术。相比标准代码加固更安全可靠。 | ||
高级代码加固使用自定义的程序集结构和自定义的指令,极大提升了App安全性。 | ||
|
||
## 原理 | ||
|
||
高级指令优化在优化过程中将IL指令提前转换为寄存器指令,并且做复杂的优化和变换,最后再输出最终的指令。 | ||
最终指令与原始IL指令不仅指令集不同,也不存在一一对应关系,无法直接逆向,极大提高了代码安全性。 | ||
|
||
高级代码加固技术从以下几个方面提升了代码安全性: | ||
|
||
- 使用自定义的可随机化的程序集结构。程序集结构定义本身是可以随机化的,通过生成相应的专有代码 | ||
来解析相应结构,极大提高了破解难度 | ||
- 对所有元数据结构进行自定义的转换,使得无法再被常规的IL反编译工具(如ILSpy)读取 | ||
- 提前将IL指令不可逆地转换为自定义寄存器指令集,指令集本身也可以随机化 | ||
|
||
|
||
## 其他优势 | ||
|
||
- 由于已经离线提前转换为自定义寄存器指令集,指令翻译更快 | ||
- 与高级指令优化技术配合,最大程度提升执行效率 | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# IL解释器 | ||
|
||
直接执行原始IL指令的解释器。 | ||
|
||
## 介绍 | ||
|
||
hybridclr提供的寄存器指令解释器在执行前将原始IL指令转换为独有的寄存器指令,再解释执行。其中不仅有转换指令的开销, | ||
转换后的指令还会占用大量内存。对于大多数dll,充分运行后转换后的寄存器指令大约会占0.9-1.5倍dll大小内存。这对于WebGL | ||
平台来说,是一个不可忽视的开销。 | ||
|
||
我们实现一个直接解释执行原始IL指令的解释器,虽然会明显降低了执行性能,但节约了内存。在一些内存紧张的场合,有一定实践意义。 | ||
|
||
## 优点 | ||
|
||
- 执行前不需要指令转换,启动更快 | ||
- 不需要转换为寄存器指令,节约内存 | ||
- 可以实施一些有用的执行策略,例如执行10遍后切换到寄存器指令执行模式 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 11 additions & 9 deletions
20
.../en/docusaurus-plugin-content-docs/current/business/advancedcodeoptimization.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,30 @@ | ||
# Advanced instruction optimization | ||
|
||
:::warning | ||
Advanced instruction optimization is still under development and is expected to have a preview version in October 2023. | ||
Advanced instruction optimizations are still under development. | ||
::: | ||
|
||
Advanced instruction optimization techniques are implemented independently of standard instruction optimization techniques. Advanced instruction optimization technology uses richer compilation optimization technology to greatly improve the performance of the interpretation module. | ||
The overall execution performance of optimized instructions is improved by 100%-1000% (you read that right, more than 10 times) or even higher, especially the overall improvement of numerical instructions by nearly 300%. | ||
Advanced instruction optimization technology is an implementation independent of standard instruction optimization technology. Advanced instruction optimization technology uses richer compilation optimization technology to greatly improve the performance of the interpretation module. | ||
After optimization, the overall instruction execution performance is improved by 100%-1000% (yes, more than 10 times) or even higher, especially the overall improvement of numerical instructions by nearly 300%. | ||
And because it has been converted in advance, the loading and instruction translation process is faster and the lag is smaller. | ||
|
||
## Implementation | ||
## accomplish | ||
|
||
Advanced instruction optimization techniques include the following optimization techniques: | ||
Advanced instruction optimization technology includes the following optimization technologies: | ||
|
||
- Complete elimination of useless stack instructions. Eliminate all unnecessary stack operations | ||
- Peephole optimization | ||
- Constant copy optimization | ||
- Optimization of local copy propagation | ||
- Global copy propagation optimization | ||
- Function inline, even inline AOT function | ||
- Provide more intrinsic instructions, greatly improving the performance of common instruction combinations | ||
- CheckOnce runtime checks dynamically eliminate optimizations. For example, the instruction to access the static member variable no longer checks whether the type has been initialized when it is executed for the second time | ||
- Explain function inline | ||
- AOT function inline (patented technology) | ||
- Provide more instinct instructions to greatly improve the performance of common instruction combinations | ||
- Conditional check elimination technology. Eliminate unnecessary null pointer checks, type cast checks, and array out-of-bounds checks | ||
- CheckOnce runtime checks dynamically eliminate optimizations. For example, an instruction that accesses a static member variable will no longer check whether the type has been initialized during the second execution. | ||
- Other optimizations | ||
|
||
|
||
## Performance | ||
|
||
Will test again after release. | ||
TODO. |
19 changes: 15 additions & 4 deletions
19
i18n/en/docusaurus-plugin-content-docs/current/business/advancedencryption.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,19 @@ | ||
# Advanced Code Encryption | ||
# Advanced code hardening | ||
|
||
Advanced code encryption is a derivative of advanced instruction optimization technology. It is safer and more reliable than standard code encryption. | ||
Advanced code hardening uses custom assembly structures and custom instructions to greatly improve App security. | ||
|
||
## Principle | ||
|
||
Advanced instruction optimization converts IL instructions into register instructions in advance during the optimization process, and performs complex optimization and transformation, and finally outputs the final instructions. | ||
The final instruction and the original IL instruction not only have different instruction sets, but also do not have a one-to-one correspondence. They cannot be directly reversed, which greatly improves code security. | ||
|
||
Advanced code hardening technology improves code security in the following aspects: | ||
|
||
- Use custom randomizable assembly structures. The assembly structure definition itself can be randomized by generating corresponding proprietary code | ||
To analyze the corresponding structure, greatly improving the difficulty of cracking | ||
- Custom transformation of all metadata structures so that they can no longer be read by regular IL decompilation tools (such as ILSpy) | ||
- Irreversibly convert IL instructions into custom register instruction sets in advance, and the instruction set itself can also be randomized | ||
|
||
|
||
## Other advantages | ||
|
||
- Since it has been converted offline to a custom register instruction set in advance, instruction translation is faster | ||
- Cooperate with advanced instruction optimization technology to maximize execution efficiency |
17 changes: 17 additions & 0 deletions
17
i18n/en/docusaurus-plugin-content-docs/current/business/ilinterpreter.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# IL interpreter | ||
|
||
Interpreter that directly executes raw IL instructions. | ||
|
||
## introduce | ||
|
||
The register instruction interpreter provided by hybridclr converts the original IL instruction into a unique register instruction before execution, and then interprets and executes it. There is not only the overhead of conversion instructions, | ||
The converted instructions also take up a lot of memory. For most dlls, the converted register instructions will occupy approximately 0.9-1.5 times the dll size memory after full operation. This is for WebGL | ||
For the platform, it is an expense that cannot be ignored. | ||
|
||
We implement an interpreter that directly interprets and executes the original IL instructions. Although it will significantly reduce the execution performance, it saves memory. In some situations where memory is tight, it has certain practical significance. | ||
|
||
## advantage | ||
|
||
- No instruction conversion required before execution, faster startup | ||
- No need to convert to register instructions, saving memory | ||
- Some useful execution strategies can be implemented, such as switching to register instruction execution mode after executing 10 times |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters