function encrypt(代码)
local func = loadstring("return function() return loadstring([["..代码.."]])() end")()
local compileCode = string.dump(func)
local encrypt = "return {"
local i = 1
while i <= #compileCode do
encrypt = encrypt .. string.byte(compileCode,i) + 256 ..","
i = i + 1
end
return encrypt.."nil}"
end
function decryptAndExecute(encrypt)
local t = loadstring(encrypt)()
local decrypt = ""
for k,v in ipairs(t) do
decrypt = decrypt .. string.char(v - 256)
end
return loadstring(decrypt)()
end
local func = loadstring("return function() return loadstring([["..代码.."]])() end")()
local compileCode = string.dump(func)
local encrypt = "return {"
local i = 1
while i <= #compileCode do
encrypt = encrypt .. string.byte(compileCode,i) + 256 ..","
i = i + 1
end
return encrypt.."nil}"
end
function decryptAndExecute(encrypt)
local t = loadstring(encrypt)()
local decrypt = ""
for k,v in ipairs(t) do
decrypt = decrypt .. string.char(v - 256)
end
return loadstring(decrypt)()
end