Module:Sandbox/Thundercraft5

local p = {}

require('Module:LoadLib')(_G)

local temp = {} local nums = string.split('abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*[]{}<>?;:-+=/\\_|\`\"\'\t\n\r\v\b', '')

for i, letter in ipairs(nums) do	temp[i] = letter end nums = temp

local letters = {} for k, v in pairs(nums) do	letters[v] = k	end

function p.encode(...) local s, key = checkTypeArgs({ 'string', 'number' }, ...) math.randomseed(key) key = tostring(math.random):gsub('^0%.', '%1'):match('%d%d%d%d') local i = 0 local maxLen = 5 return s:gsub('(.)', function(c)		i = i+1		local code = (letters[c] or error(c))*key		local temp = string.toHex(code)		local len = #temp		mw.log(len)		temp = temp..string.rep('h', maxLen-len)		return temp	end) end

function p.decode(...) local s, key = checkTypeArgs({ 'string', 'number' }, ...) local ret = {} math.randomseed(key) key = tostring(math.random):gsub('^0%.', '%1'):match('%d%d%d%d') for code in s:gmatch('.....') do		table.push(ret, nums[tonumber(code:gsub('h', ''), 16)/key]) end

return table.concat(ret, '') end

function p.test(frame) local args = getArgs(frame)

return tostring(mw.html.create('group')		:tag('data')			:tag('label')				:wikitext("Test")			:done			:tag('format')				:wikitext("Test")			:done		:done	:done) end return p