function Base64.Decode(j,N)local C={}local f=0 for j=1,#N,4 do local o,l,b,A=string.byte(N,j,j+3)local J=Indexes[o]-1 local R=Indexes[l]-1 local c=(Indexes[b]or 1)-1 local s=(Indexes[A]or 1)-1 local M=bit32_lshift(J,2)+bit32_rshift(R,4)local u=bit32_lshift(bit32_band(R,15),4)+bit32_rshift(c,2)local y=bit32_lshift(bit32_band(c,3),6)+s f=f+1 C[f]=M if b~=61 then f=f+1 C[f]=u end if A~=61 then f=f+1 C[f]=y end end local o={}local l=0 for N=1,f,4096 do l=l+1 o[l]=string.char(table.unpack(C,N,math.min((N+4096)-1,f)))end return table.concat(o)end return Base64

function Base64:Decode(Input)
	local Output = {}
	local Length = 0

	for Index = 1, #Input, 4 do
		local C1, C2, C3, C4 = string.byte(Input, Index, Index + 3)

		local I1 = Indexes[C1] - 1
		local I2 = Indexes[C2] - 1
		local I3 = (Indexes[C3] or 1) - 1
		local I4 = (Indexes[C4] or 1) - 1

		local A = bit32_lshift(I1, 2) + bit32_rshift(I2, 4)
		local B = bit32_lshift(bit32_band(I2, 15), 4) + bit32_rshift(I3, 2)
		local C = bit32_lshift(bit32_band(I3, 3), 6) + I4

		Length = Length + 1
		Output[Length] = A
		if C3 ~= 61 then Length = Length + 1 Output[Length] = B end
		if C4 ~= 61 then Length = Length + 1 Output[Length] = C end
	end

	local NewOutput = {}
	local NewLength = 0

	for Index = 1, Length, 4096 do
		NewLength = NewLength + 1
		NewOutput[NewLength] = string.char(table.unpack(Output, Index, math.min(Index + 4096 - 1, Length)))
	end

	return table.concat(NewOutput)
end

return Base64
