Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
Nodemcu Firmware
Commits
b4f0c2d1
Commit
b4f0c2d1
authored
Jun 25, 2015
by
Luna
Browse files
another one
parent
ba39d096
Changes
1
Hide whitespace changes
Inline
Side-by-side
lua_modules/base64/base64_v2.lua
View file @
b4f0c2d1
...
@@ -4,7 +4,8 @@ local tab = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
...
@@ -4,7 +4,8 @@ local tab = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
base64
=
{
base64
=
{
enc
=
function
(
data
)
enc
=
function
(
data
)
local
l
,
out
=
0
,
''
local
l
,
out
=
0
,
''
local
d
=
data
..
string.rep
(
'
\0
'
,(
3
-
data
:
len
()
%
3
)
%
3
)
local
m
=
(
3
-
data
:
len
()
%
3
)
%
3
local
d
=
data
..
string.rep
(
'
\0
'
,
m
)
for
i
=
1
,
d
:
len
()
do
for
i
=
1
,
d
:
len
()
do
l
=
bit
.
lshift
(
l
,
8
)
l
=
bit
.
lshift
(
l
,
8
)
l
=
l
+
d
:
byte
(
i
,
i
)
l
=
l
+
d
:
byte
(
i
,
i
)
...
@@ -16,7 +17,7 @@ base64 = {
...
@@ -16,7 +17,7 @@ base64 = {
end
end
end
end
end
end
return
out
..
({
''
,
'=='
,
'='
})[
data
:
len
()
%
3
+
1
]
return
out
:
sub
(
1
,
-
1
-
m
)
..
string.rep
(
'='
,
m
)
end
,
end
,
dec
=
function
(
data
)
dec
=
function
(
data
)
local
a
,
b
=
data
:
gsub
(
'='
,
'A'
)
local
a
,
b
=
data
:
gsub
(
'='
,
'A'
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment