--[[
	
	local base64 = Base64.new()
	
	Example:
	
	local myEncodedWord = base64:Encode("Hello")
	
	print(myEncodedWord)
	
	-- outputs: SGVsbG8=
	
	print(base64:Decode(myEncodedWord))
	
	-- outputs: Hello

--]]


local Alphabet = {}
local Indexes = {}

for Index = 65, 90 do table.insert(Alphabet, Index) end -- A-Z
for Index = 97, 122 do table.insert(Alphabet, Index) end -- a-z
for Index = 48, 57 do table.insert(Alphabet, Index) end -- 0-9

table.insert(Alphabet, 43) -- +
table.insert(Alphabet, 47) -- /

for Index, Character in ipairs(Alphabet) do
	Indexes[Character] = Index
end

local Base64 = {
	ClassName = "Base64";
	__tostring = function(self) return self.ClassName end;
}

Base64.__index = Base64

local bit32_rshift = bit32.rshift
local bit32_lshift = bit32.lshift
local bit32_band = bit32.band

function Base64.new()
	return setmetatable({}, Base64)
end
