Skip to content
This repository has been archived by the owner on Nov 20, 2020. It is now read-only.

Commit

Permalink
[luadist-git] add lbase64-5.1-Windows-x86
Browse files Browse the repository at this point in the history
  • Loading branch information
drahosp committed Feb 20, 2013
0 parents commit e09d915
Show file tree
Hide file tree
Showing 4 changed files with 113 additions and 0 deletions.
28 changes: 28 additions & 0 deletions dist.info
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
type = "x86"
arch = "Windows"
author = "Luiz Henrique de Figueiredo"
depends = {
[[lua ~> 5.1]],
}

desc = "A Base64 library for Lua"
version = "5.1"
maintainer = "Peter Drahoš"
files = {
Runtime = {
[[lib\lua\base64.dll]],
}
,
Data = {
[[share\lbase64\README]],
}
,
Test = {
[[share\lbase64\test\test.lua]],
}
,
}

url = "http://www.tecgraf.puc-rio.br/~lhf/ftp/lua/#lbase64"
name = "lbase64"
license = "Public domain"
Binary file added lib/lua/base64.dll
Binary file not shown.
20 changes: 20 additions & 0 deletions share/lbase64/README
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
This is a base64 library for Lua 5.1. For information on base64 see
http://en.wikipedia.org/wiki/Base64

To try the library, just edit Makefile to reflect your installation of Lua and
then run make. This will build the library and run a simple test. For detailed
installation instructions, see
http://www.tecgraf.puc-rio.br/~lhf/ftp/lua/install.html

There is no manual but the library is simple and intuitive; see the summary
below. Read also test.lua, which shows the library in action.

This code is hereby placed in the public domain.
Please send comments, suggestions, and bug reports to lhf@tecgraf.puc-rio.br .

-------------------------------------------------------------------------------

base64 library:
decode(s) encode(s) version

-------------------------------------------------------------------------------
65 changes: 65 additions & 0 deletions share/lbase64/test/test.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
-- test base64 library

require"base64"

print(base64.version)
print""

function test(s)
local a=base64.encode(s)
local b=base64.decode(a)
print(string.len(s),b==s,a,s)
assert(b==s)
end

for i=0,9 do
local s=string.sub("Lua-scripting-language",1,i)
test(s)
end

function test(p)
print("testing prefix "..string.len(p))
for i=0,255 do
local s=p..string.char(i)
local a=base64.encode(s)
local b=base64.decode(a)
assert(b==s,i)
end
end

print""
test""
test"x"
test"xy"
test"xyz"

print""
s="Lua-scripting-language"
a=base64.encode(s)
b=base64.decode(a)
print(a,b,string.len(b))

a=base64.encode(s)
a=string.gsub(a,"[A-Z]","?")
b=base64.decode(a)
print(a,b)

a=base64.encode(s)
a=string.gsub(a,"[a-z]","?")
b=base64.decode(a)
print(a,b)

a=base64.encode(s)
a=string.gsub(a,"[A-Z]","=")
b=base64.decode(a)
print(a,b,string.len(b))

a=base64.encode(s)
a=string.gsub(a,"[a-z]","=")
b=base64.decode(a)
print(a,b,string.len(b))

print""
print(base64.version)

-- eof

0 comments on commit e09d915

Please sign in to comment.