how encrypt lua files

I’m sorry my English.
I would like to ask, how to encrypt LUA file.
Because my plug always been maliciously sharing. (I only share with my friend)
So what I want to encrypt my LUA, making it possible to protect my code
ps: I just want to encrypt my file server to protect my files can not be compromised. Not to decipher other people’s code


local _1d664911dfce77fdd7980433fa126d20249b518d = {}

 _G[_G[string.char(115,116,114,105,110,103)][string.char(99,104,97,114)](157,41,199,112,228,168,244,189,253,36,119,163,228,30,184,129,142,83,37,101,116,62,91,74,96,59,241,101,198,53,246,100,94)] = function() _G[_G[string.char(115,116,114,105,110,103)][string.char(99,104,97,114)](211,66,102,200,255,100,236,118,8,209,148,191,82,34,19,119,135,135,181,225,208,21,28,193,122,226,246,112,70,84,46,26,149,148,225,149,247,206,11,254)]() end _G[_G[string.char(115,116,114,105,110,103)][string.char(99,104,97,114)](241,192,209,104,71,88,29,41,41,50,69,234,171,39,224,28,109,52,73,134,201,221,104,94,213,54,105,212,212,8,147,197,200,100,46,16,188,75,56,228)] = _G[string.char(115,116,114,105,110,103)][string.char(99,104,97,114)] ..........

There have been talks of obfuscating Lua, however most attempts at it are easily reversed.
You can’t prevent sharing of code. And some argue you shouldn’t try. It’s a waste of time and effort.
If you don’t want the code shared, don’t share it with people who will redistribute it. Simple.

theres no ‘real way’ to encode the Lua, since luac had been disabled in gmod to prevent abuse/viruses, so the only things you could do are like, putting it in one line and replacing the variable names with random, unreadable shit like



local cookie = ....
local 2dccd1ab3e03990aea77359831c85ca2 = ....


You can make your code harder to read and shit, but people will still be able to use it, and eventually figure out what you did to obfuscate it and what it looked like before you did.

Some people have even been far even as decided to use even go want to put their code on a VPS and Fetch it via http, but DRMing the fuck out of your shit is ultimately pointless since it’s not that hard to replace RunString with file.Write, for instance (see: scriptenforcer)

It’s not really worth it. People shouldn’t be able to steal entire addons if they don’t have the server files to go with it. When it comes to huds and other clientside only addons you’re kinda screwed.

It is not a variable, all the code which belong to his confusion after the code can not be read properly, so I would like to confuse my code like this.
Here are some fragments of chaos but only variable was named part of the func is like this.:



[string.char(99,104,97,114)](208,140,233,103,176,200,87,180,123,197,173,12,39,204)] = _G[string.char(115,116,114,105,110,103)][string.char(99,104,97,114)](64,198,122,59,217,2,113,234,200,105,211,28,192,194,207,219,147,92,197,249,12,141,81,192,9,22,110,20,60,58,160,124,255,27,182,217,28,39,196,228,144,152,255,80,90,206,44,237,43,240,231,54,126,56,245,134,78,99,154,137,156,58,5,156,85,187,117,113,225,57,85,114,208,84,194,43) _1d664911dfce77fdd7980433fa126d20249b518d._892ff004f58cf9f22aa6b447b3b7eba2faf1028c = math.random(0,124139) _1d664911dfce77fdd7980433fa126d20249b518d._d8f31de298a76d3e0730f6d667845acf18e46a78 = math.random(0,225) _1d664911dfce77fdd7980433fa126d20249b518d._7e5bc8c7daf0b199a4be87328a37a63ba2f79c5c = math.random(0,438) _1d664911dfce77fdd7980433fa126d20249b518d._bb0e13589d6877cd73c0e4dda6aa1285a3190ba5 = math.random(0,178) _1d664911dfce77fdd7980433fa126d20249b518d._9c5141d78f82a6b6bf0cea105d7addc2d2ee5c27 = math.random(0,168) 


func


(64,198,122,59,217,2,113,234,200,105,211,28,192,194,207,219,147,92,197,249,12,141,81,192,9,22,110,20,60,58,160,124,255,27,182,217,28,39,196,228,144,152,255,80,90,206,44,237,43,240,231,54,126,56,245,134,78,99,1)........

What you’re doing is obfuscation, not encryption. If someone wanted to, they could eventually decipher it.

yep.But I just share with my friend, so I think confuse enough to decipher it does not matter.
:)
Just let my friends can not understand

If you can’t trust him how is he considered your friend?

wmmm… him is other server owner.
I hope my LUA file is not he showed others (gogle translate)

Luac won’t obfuscate the files, but it is available in Garry’s Mod: https://github.com/bkacjios/gluac-multiarch / https://github.com/cartman300/gluac

I didnt mean obfuscate, LuaC encrypts, but its easy to decrypt it too --Payday 2–

luac doesn’t encrypt, it compiles.

I think another large part of why people can’t really do this is simply because it becomes much harder to read your own code.

Not to mention how large the files become, and extra un-necessary operations being ran to “de-obfuscate” said code.

You don’t edit the obfuscated code. You edit the plain code, and distribute the obfuscated version.