|
| 23 Jul 2012 11:32 AM |
Lua 5.2 doesn't have a loadstring function. Instead, the ability to load code from strings has been added to the load function, which already exists in Lua 5.1 but doesn't have that ability.
Also, in Lua 5.2, bytecode verification was removed. This is because the bytecode verification in Lua was already filled with flaws and was becoming too complicated, so they just decided to get rid of it.
Of course, in a such case, ROBLOX can't afford to keep bytecode loading, because that would be too dangerous. There are already tricks using bytecode that allow scripters to do things they shouldn't be able to do, and if they update to Lua 5.2, which they have the intention to do, there are going to be even more of such tricks and exploits using bytecode.
This is why they decided that they would just remove bytecode loading completely (confirmed in a thread posted on the forums by Shedletsky). Because of this, you shouldn't use bytecode loading anymore, otherwise, your code will break when they update.
This also means you shouldn't obfuscate your scripts anymore using bytecode (see http://wiki.roblox.com/index.php/Script_Obfuscation).
However, it is important to note that what they are removing isn't loadstring or the ability to load code at all. They are just going to remove the ability to load bytecode. It will still be possible to load normal Lua code, just not bytecode. Therefore, don't worry, script builders and other things that need to load normal Lua code will still work. |
|
|
| Report Abuse |
|
|
|
| 23 Jul 2012 11:35 AM |
| There are other encryption methods anyway, I'll use Vigenere, very effective. :B |
|
|
| Report Abuse |
|
|
|
| 23 Jul 2012 11:37 AM |
| Well, the devs are going to make the source of scripts stop replicating soon, so there'll be no point in obfuscating your scripts anymore. |
|
|
| Report Abuse |
|
|
|
| 23 Jul 2012 11:45 AM |
| Oh, if THey make it where Exploiters can't get the Scripts, that's fine with Me! =D |
|
|
| Report Abuse |
|
|
|
| 23 Jul 2012 12:14 PM |
Yep.
So obfuscation is going to become useless anyway, except if you want to distribute code in a model and want it to be obfuscated, but, in that case, you might as well just give the source code away. |
|
|
| Report Abuse |
|
|
|
| 25 Jul 2012 05:36 AM |
| I still wonder when they're going to update to Lua 5.2. |
|
|
| Report Abuse |
|
|
Cheater
|
  |
| Joined: 29 Jun 2007 |
| Total Posts: 5258 |
|
| |
|
oxcool1
|
  |
| Joined: 05 Nov 2009 |
| Total Posts: 15444 |
|
| |
|
velibor
|
  |
| Joined: 24 Nov 2009 |
| Total Posts: 1003 |
|
|
| 25 Jul 2012 07:35 AM |
ElecktrixAxel
Like this ;-)
function Encrypt( _msg, _key ) local msg = { _msg:upper():byte( 1, -1 ) } local key = { _key:upper():byte( 1, -1 ) } local enc = {} local j, k = 1, 1 for i = 1, #msg do if msg[i] >= string.byte('A') and msg[i] <= string.byte('Z') then enc[k] = ( msg[i] + key[j] - 2*string.byte('A') ) % 26 + string.byte('A') k = k + 1 if j == #key then j = 1 else j = j + 1 end end end return string.char( unpack(enc) ) end function Decrypt( _msg, _key ) local msg = { _msg:byte( 1, -1 ) } local key = { _key:upper():byte( 1, -1 ) } local dec = {} local j = 1 for i = 1, #msg do dec[i] = ( msg[i] - key[j] + 26 ) % 26 + string.byte('A') if j == #key then j = 1 else j = j + 1 end end return string.char( unpack(dec) ) end original = "Beware the Jabberwock, my son! The jaws that bite, the claws that catch!" key = "VIGENERECIPHER"; encrypted = Encrypt( original, key ) decrypted = Decrypt( encrypted, key ) print( encrypted ) print( decrypted )
|
|
|
| Report Abuse |
|
|
|
| 25 Jul 2012 07:15 PM |
I would do it this way:
function encrypt(txt, key) txt, key = txt:lower(), key:lower() local i = 0 return txt:gsub("%a", function(a) i = i + 1 local k = i%#key k = k == 0 and #key or k a = (a:byte()-96)+(key:sub(k, k):byte()-97) a = a%26 == 0 and 26 or a%26 return(string.char(a+96)) end) end
function decrypt(txt, key) txt, key = txt:lower(), key:lower() local i = 0 return txt:gsub("%a", function(a) i = i + 1 local k = i%#key k = k == 0 and #key or k a = (a:byte()-96)-(key:sub(k, k):byte()-97) a = a%26 == 0 and 26 or a%26 return(string.char(a+96)) end) end |
|
|
| Report Abuse |
|
|