File tree Expand file tree Collapse file tree 1 file changed +19
-1
lines changed
Expand file tree Collapse file tree 1 file changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -103,11 +103,29 @@ function EncryptStrings:CreateEncrypionService()
103103 local code = [[
104104do
105105 local floor = math.floor
106+ local random = math.random;
107+ local remove = table.remove;
108+ local char = string.char;
106109 local param_mul_8 = ]] .. tostring (param_mul_8 ) .. [[
107110 local param_mul_45 = ]] .. tostring (param_mul_45 ) .. [[
108111 local param_add_45 = ]] .. tostring (param_add_45 ) .. [[
109112 local state_45 = 0
110113 local state_8 = 2
114+ local digits = {}
115+ local charmap = {};
116+ local i = 0;
117+
118+ local nums = {};
119+ for i = 1, 256 do
120+ nums[i] = i;
121+ end
122+
123+ repeat
124+ local idx = random(1, #nums);
125+ local n = remove(nums, idx);
126+ charmap[n] = char(n - 1);
127+ until #nums == 0;
128+
111129 local prev_values = {}
112130 local function get_next_pseudo_random_byte()
113131 if #prev_values == 0 then
145163 local len = string.len(str);
146164 local out = "";
147165 for i=1, len do
148- out = out .. string.char(( string.byte(str, i) - get_next_pseudo_random_byte()) % 256) ;
166+ out = out .. charmap[( string.byte(str, i) - get_next_pseudo_random_byte()) % 256 + 1] ;
149167 end
150168 realStrings[seed] = out;
151169 return seed;
You can’t perform that action at this time.
0 commit comments