Protected Code

Discuss using and improving Lua and the Lua Player specific to the PSP.

Moderators: Shine, Insert_witty_name

Post Reply
Giuliano
Posts: 78
Joined: Tue Sep 13, 2005 10:26 am

Protected Code

Post by Giuliano »

Any chance in the near future that Lua will provide some kind of way to "compile" the code so that no one else can view it ? Perhaps some kind of password scheme or something even would be nice...

I know that Lua is all about dev'ing for the PSP and being freeware but if someone is to create something in Lua and wish to keep others from stealing any code then it wouldnt be possible
KawaGeo
Posts: 191
Joined: Sat Aug 27, 2005 6:52 am
Location: Calif Mountains

Post by KawaGeo »

I don't think it is possible to "hide" your code in Lua. One way I could think of is to convert Lua code to C and then compile it. I don't know if such a converter does exist. Better ask the big boys at Lua group.
Geo Massar
Retired Engineer
Giuliano
Posts: 78
Joined: Tue Sep 13, 2005 10:26 am

Post by Giuliano »

I know it's not possible but I was asking if in the future it will be :)
chaos
Posts: 135
Joined: Sun Apr 10, 2005 5:05 pm

Post by chaos »

you could write a lua obfuscator...
Chaosmachine Studios: High Quality Homebrew.
ksilvert
Posts: 5
Joined: Tue Sep 06, 2005 12:02 am

Post by ksilvert »

I could be wrong, but I thought that the .10 release included a way to compile your lua code into an eboot? I haven't tried this yet....but it may be what you're looking for.
LuMo
Posts: 410
Joined: Sun Aug 21, 2005 2:45 am
Location: Austria
Contact:

Post by LuMo »

chaos wrote:you could write a lua obfuscator...
nice idea, but most of those obfuscator's are tricked easily (see javascript, just use your search and replace-tool to rebuild the code)

one way to "fuck up" the code is renaming the variables to senseless stuff (which some developers already do when they code *lol*) this would make it harder to read/understand your program
ksilvert wrote: I could be wrong, but I thought that the .10 release included a way to compile your lua code into an eboot? I haven't tried this yet....but it may be what you're looking for.
afaik is it only possible to build it so you can use your own images and have your lua in the root folder of your app (no compiling from lua2c)

greets Lumo
PS: you could even encode your lua-code and decode(and delete the files afterwards) it at runtime (with an lua-script) but where do you store the password then ;D
"Good artists copy, great artists steal."
Pablo Picasso
go2lumo.com
MikeHaggar
Posts: 116
Joined: Mon Jul 18, 2005 2:20 am

Post by MikeHaggar »

LuMo wrote: one way to "fuck up" the code is renaming the variables to senseless stuff (which some developers already do when they code *lol*) this would make it harder to read/understand your program
I thought that was what obfuscators did?
LuMo
Posts: 410
Joined: Sun Aug 21, 2005 2:45 am
Location: Austria
Contact:

Post by LuMo »

obfusc... think it also formats the code different (remove spaces aso)
and change normal code to charcode (which can be read by machine)
anyway, quite the same :)
"Good artists copy, great artists steal."
Pablo Picasso
go2lumo.com
KawaGeo
Posts: 191
Joined: Sat Aug 27, 2005 6:52 am
Location: Calif Mountains

Post by KawaGeo »

Another way I could think of is to embed your Lua script(s) into Shine's LuaPlayer (with some mods) and compile the entire package. You got the bin file. No scripts visible. LP could then be able to read the scripts internally. Good idea. huh?
Geo Massar
Retired Engineer
LuMo
Posts: 410
Joined: Sun Aug 21, 2005 2:45 am
Location: Austria
Contact:

Post by LuMo »

humm guess thats the best idea by now :D
"Good artists copy, great artists steal."
Pablo Picasso
go2lumo.com
Shine
Posts: 728
Joined: Fri Dec 03, 2004 12:10 pm
Location: Germany

Post by Shine »

LuMo wrote:
ksilvert wrote: I could be wrong, but I thought that the .10 release included a way to compile your lua code into an eboot? I haven't tried this yet....but it may be what you're looking for.
afaik is it only possible to build it so you can use your own images and have your lua in the root folder of your app (no compiling from lua2c)

greets Lumo
PS: you could even encode your lua-code and decode(and delete the files afterwards) it at runtime (with an lua-script) but where do you store the password then ;D
There are many ways to hide the code. You can use the source code from Lua Player and just substitude the boot.lua with your code, which is linked with the EBOOT.PBP file, or you can compile your Lua script with luac or from a Lua script and save it as a Lua chunk and load this later with standard Lua functions and the ultimative code hiding would be to link this Lua chunk instead of the Lua source with your EBOOT.PBP.

Decoding on-the-fly is possible, too, without saving it first to memory stick, because AFAIK Lua can execute strings as code, but this doesn't help very much, because someone can just patch the decoding function to write it to memory stick :-)
Giuliano
Posts: 78
Joined: Tue Sep 13, 2005 10:26 am

Post by Giuliano »

So making it it's own EBOOT file is the only way ? I just don't like it because it means you have to include more files and that means more bigger size for the program. If someone has a 32mb stick they want to save as much space as possible.
KawaGeo
Posts: 191
Joined: Sat Aug 27, 2005 6:52 am
Location: Calif Mountains

Post by KawaGeo »

Is "bloated" EBOOT bigger than the combination of the regular EBOOT and all scripts required to run a program? Me thinks not so but I could be wrong.
Geo Massar
Retired Engineer
Oobles
Site Admin
Posts: 347
Joined: Sat Jan 17, 2004 9:49 am
Location: Melbourne, Australia
Contact:

Post by Oobles »

I haven't compiled the PSP version of LUA yet, however, doesn't LUA come with a compiler? The LuaPlayer would need to be modified to allow loading LuaByte code directly if it is not already supported.

Here's some information on it.

http://www.lua.org/manual/3.2/luac.html

It is still possible to decompile lua code using luadc which you can google for, but it will make your code a reasonable amount more obfuscated.

David. aka Oobles.
Post Reply