I am trying to randomize a table of byte values. However, I need to be able to unrandomize them using a key that is unique to the randomized table. Currently, I am doing the following:
local key = {}
local randomized = {}
for i = 1, #bytes do
local random = math.random(1,#bytes * #bytes)
table.insert(key,random)
table.insert(randomized,random,bytes[i])
end
This works fine because my test string (which is converted into a table of bytes) is simply “Hello world!”. However, with longer strings the key would keep getting longer and longer, and I would like to keep the key at or under 26 characters.
Any help is greatly appreciated.