Module:Sandbox/Thundercraft5

local p = {}

require('Module:LoadLib')(_G)

local temp = {} local nums = string.split('abcdefghijklmnopqrstuvwxyz', '')

for i, letter in ipairs(nums) do	temp[i] = letter table.insert(temp, letter:upper) end nums = temp

local letters = table.invert(nums)

function p.encode2(s) return (s:gsub('(.)', function(c) return letters[c:lower]..'_' end)) end

function p.decode2(s) return (s:gsub('(%d+)_', function(n) return nums[tonumber(n)] end)) end

function p.encode(s, seed) math.randomseed(seed)

return (s:gsub('(.)', function local n = math.random(1, 26) mw.log(n) return n	end)) end

function p.decode(s, seed) math.randomseed(seed) local keys = {} local ret = {} local i = 1 for i = 1, seed do		local n = math.random(1, 26) mw.log(n) keys[i] = n	end while s ~=  do		s = s:gsub('^'..keys[i], ) table.push(ret, nums[keys[i]]) i = i+1 end return table.concat(ret, '') end

return p