Add base64 decode to the IVR Menu.

This commit is contained in:
Mark Crane
2015-03-31 00:50:13 +00:00
parent 4f6f1186ab
commit bf09ca3e1c
3 changed files with 81 additions and 3 deletions

View File

@@ -6,7 +6,7 @@ base64={}
local b='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
-- encoding
function base64.enc(data)
function base64.encode(data)
return ((data:gsub('.', function(x)
local r,b='',x:byte()
for i=8,1,-1 do r=r..(b%2^i-b%2^(i-1)>0 and '1' or '0') end
@@ -20,7 +20,7 @@ function base64.enc(data)
end
-- decoding
function base64.dec(data)
function base64.decode(data)
data = string.gsub(data, '[^'..b..'=]', '')
return (data:gsub('.', function(x)
if (x == '=') then return '' end