Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function base64.decode(data)
- data = string.gsub(data, '[^' .. b .. '=]', '')
- local decoded = (data:gsub('.', function(x)
- if (x == '=') then
- return ''
- end
- local r, f = '', (b:find(x) - 1)
- for i = 6, 1, -1 do
- r = r .. (f % 2^i - f % 2^(i - 1) > 0 and '1' or '0')
- end
- return r
- end):gsub('%d%d%d%d%d%d%d%d', function(x)
- local c = 0
- for i = 1, 8 do
- c = c + (x:sub(i, i) == '1' and 2^(8 - i) or 0)
- end
- return string.char(c)
- end))
- return decoded
- end
- local utf8DecodedData = base64.decode(base64.decode(e))
- utf8DecodedData = utf8DecodedData:gsub('.', function(c)
- return utf8.char(utf8.codepoint(c))
- end)
Add Comment
Please, Sign In to add comment