Fatal problem: LUA source code encrypt.

If u publish a new software like APK or IOS app,
It’s eazy to be decoded by other dicks.
Anyone has some way to avoid this? :frowning:

OK, I got some guys solution:

In “lauxlib.c”, you need change this function:
LUALIB_API int luaL_loadfile (lua_State L, const charfilename)

and all processes below:

  1. support you need encrypt aaa.lua.
  2. gzip with password —> aaa.lua.
  3. in luaL_loadfile, read aaa.lua buff and ungzip the buff.

If u still worry your password got hacked. u can add some kinky encode/decode functions in step2. :slight_smile:

And if hackers break your app package. He can only get a load of binary files which only can decode in your APPS.

Hope cocos2d-x.org can provide tools and libs to protect our sweaty works. :frowning:

Why not compile with a 32bit lua? And load the bytecode?

Using luac?
Can u plz give more details? :smiley:

see https://github.com/dualface/quick-cocos2d-x/blob/master/bin/compile_framework_to_c.sh

compile your lua codes to c.

Sorry. I need to encrypt all my lua files one by one.
So I can update one of my files online.
—- As we know, ios app check-period is too long for online games.

Then use luac (a 32bit version is needed)

luac main.lua - this produces a output file which should be renamed later to main.lua or whatever you wan’t

luac doesn’t work in Android, I’ve tried compiling the hello.lua from the example into android but seems that it cannot load the compiled lua file in /asset folder. Anyone know how to fix this?

yvan chui wrote:

luac doesn’t work in Android, I’ve tried compiling the hello.lua from the example into android but seems that it cannot load the compiled lua file in /asset folder. Anyone know how to fix this?

see http://www.cocos2d-x.org/boards/11/topics/24681
【2.4】

The big problem you will find, is that Lua bytecode is not portable. Therefore, if you compile on desktop (Windows, Mac, Linux, etc.) you may or may not be able to load it on device (Android, iOS, BlackBerry 10, etc.).

The way around this is to ensure the bytecode format matches what the target device expects.