[英]Is it possible to hide strings from Lua compiled code?
I have a path for a file specified as a string in my code, and I don't want to be visible after luac conversion.我的代码中有一个指定为字符串的文件路径,我不想在 luac 转换后可见。 Is it possible obfuscate somehow the line?是否有可能以某种方式混淆这条线? My code is:我的代码是:
DIR1 = '../../../files/file1.txt'
Thank you!谢谢!
Yes.是的。
Example:示例:
local Key53 = 8186484168865098
local Key14 = 4887
function decode(str)
local K, F = Key53, 16384 + Key14
return (str:gsub('%x%x',
function(c)
local L = K % 274877906944 -- 2^38
local H = (K - L) / 274877906944
local M = H % 128
c = tonumber(c, 16)
local m = (c + (H - M) / 128) * (2*M + 1) % 256
K = L * F + H + c + m
return string.char(m)
end
))
end
local path = decode"beb81858c47a5fc7e11721921fb7f58ceeb530c4e74034df"
print(path) --> ../../../files/file1.txt
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.