你如何设计一个字节代码? [英] How do you 'design' a byte code?

查看:91
本文介绍了你如何设计一个字节代码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经为我的游戏创建了脚本引擎的解释器,我已经创建了它。但问题是我不希望其他人能够看到代码(脚本),为此,我需要创建一个编译器,将脚本编译为字节代码。但是你如何'设计'一个字节代码?我是如何做到这一点的,尽量让人们尽可能地理解它,同时让它更容易为解释者解释它。



我尝试了什么:



我设计了一个字体代码,用户更难以理解,并且解释器执行速度非常快。但问题是虽然人类无法理解字节代码,但可以为我当前的字节代码制作反编译器,但有点困难。这就是我当前编译器的结果:

I've been created an interpreter for an scripting engine for my games, and I've created it. But the problem is that I don't want to others to be able to see the code (script), for that, I need to create a compiler that compiles the script to a byte code. But how do you 'design' a byte code? How I do it is try to make it as hard as possible for a human to understand it, while making it easier to interpret it for the interpreter.

What I have tried:

I've designed a byte code that is harder for the user to understand, and is very fast for the interpreter to execute. But the problem is that although a human cannot understand the byte code, a decompiler can be made for the current byte code I have, with a bit of difficult. This is how I my current compiler results:

<br />
QWriteLn('Hello')<br />
<br />
Results in:<br />
<br />
'ex<br />
QWriteLn<br />
's1<br />
Hello<br />
'e1<br />





这就是它的含义:



This is what it means:

<br />
'ex           Execute the function below<br />
QWriteLn      This is the function<br />
's1           it's a string argument to the function which is on line 1<br />
Hello         This is what 's1 is referring to<br />
'e1           This marks the end for the function<br />





如您所见,这个字节代码可以被理解(即使我没有解释过)。如何设计难以理解/反编译的字节代码?



As you can see, this byte code can be understood (even if I hadn't explained it). How do I design a byte code that's hard to understand/decompile?

推荐答案

不要打扰。

如果你有一个系统工作,只需加密数据,并在需要时将其解密到您的程序中。

根据您编写游戏的语言,某种形式的加密可能是内置的,或者很容易作为库。

这样做的好处是你的字符串也是加密的,这使得它更难理解......
Don't bother.
If you have a system that works, just encrypt the data, and decrypt it into your program when you need it.
Depending on the language you wrote the game in, encryption in some form is probably built in, or easily available as a library.
The advantage of this is that your strings are also encrypted, and that makes it even harder to understand...


这篇关于你如何设计一个字节代码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆