summaryrefslogtreecommitdiff
path: root/Data/BuiltIn/Libraries/lbase64
diff options
context:
space:
mode:
Diffstat (limited to 'Data/BuiltIn/Libraries/lbase64')
-rw-r--r--Data/BuiltIn/Libraries/lbase64/.gitignore3
-rw-r--r--Data/BuiltIn/Libraries/lbase64/.travis.yml25
-rw-r--r--Data/BuiltIn/Libraries/lbase64/README.md48
-rw-r--r--Data/BuiltIn/Libraries/lbase64/base64.lua201
-rw-r--r--Data/BuiltIn/Libraries/lbase64/bench.lua76
-rw-r--r--Data/BuiltIn/Libraries/lbase64/rockspec/base64-1.5-1.rockspec20
-rw-r--r--Data/BuiltIn/Libraries/lbase64/rockspec/base64-1.5-2.rockspec20
-rw-r--r--Data/BuiltIn/Libraries/lbase64/rockspec/base64-1.5-3.rockspec20
-rw-r--r--Data/BuiltIn/Libraries/lbase64/test.lua47
9 files changed, 460 insertions, 0 deletions
diff --git a/Data/BuiltIn/Libraries/lbase64/.gitignore b/Data/BuiltIn/Libraries/lbase64/.gitignore
new file mode 100644
index 0000000..a70719a
--- /dev/null
+++ b/Data/BuiltIn/Libraries/lbase64/.gitignore
@@ -0,0 +1,3 @@
+*.out
+*.swp
+*.swo
diff --git a/Data/BuiltIn/Libraries/lbase64/.travis.yml b/Data/BuiltIn/Libraries/lbase64/.travis.yml
new file mode 100644
index 0000000..7bca356
--- /dev/null
+++ b/Data/BuiltIn/Libraries/lbase64/.travis.yml
@@ -0,0 +1,25 @@
+language: python
+sudo: false
+
+env:
+ - LUA="lua 5.1"
+ - LUA="lua 5.2"
+ - LUA="lua 5.3"
+ - LUA="lua 5.4"
+ - LUA="luajit 2.0"
+ - LUA="luajit 2.1"
+
+before_install:
+ - pip install hererocks
+ - hererocks env --$LUA -rlatest # Use latest LuaRocks, install into 'env' directory.
+ - source env/bin/activate # Add directory with all installed binaries to PATH.notifications:
+
+notifications:
+ email: false
+
+install:
+ - luarocks install luacheck
+
+script:
+ - luacheck --no-unused-args *.lua
+ - lua test.lua
diff --git a/Data/BuiltIn/Libraries/lbase64/README.md b/Data/BuiltIn/Libraries/lbase64/README.md
new file mode 100644
index 0000000..1b5b0ee
--- /dev/null
+++ b/Data/BuiltIn/Libraries/lbase64/README.md
@@ -0,0 +1,48 @@
+[![Build Status](https://travis-ci.org/iskolbin/lbase64.svg?branch=master)](https://travis-ci.org/iskolbin/lbase64)
+[![license](https://img.shields.io/badge/license-public%20domain-blue.svg)]()
+[![MIT Licence](https://badges.frapsoft.com/os/mit/mit.svg?v=103)](https://opensource.org/licenses/mit-license.php)
+
+Lua base64 encoder/decoder
+==========================
+
+Pure Lua [base64](https://en.wikipedia.org/wiki/Base64) encoder/decoder. Works with
+Lua 5.1+ and LuaJIT. Fallbacks to pure Lua bit operations if bit/bit32/native bit
+operators are not available.
+
+```lua
+local base64 = require'base64'
+local str = 'Man is distinguished, not only by his reason, but by this singular passion from other animals, which is a lust of the mind, that by a perseverance of delight in the continued and indefatigable generation of knowledge, exceeds the short vehemence of any carnal pleasure.'
+local b64str = 'TWFuIGlzIGRpc3Rpbmd1aXNoZWQsIG5vdCBvbmx5IGJ5IGhpcyByZWFzb24sIGJ1dCBieSB0aGlzIHNpbmd1bGFyIHBhc3Npb24gZnJvbSBvdGhlciBhbmltYWxzLCB3aGljaCBpcyBhIGx1c3Qgb2YgdGhlIG1pbmQsIHRoYXQgYnkgYSBwZXJzZXZlcmFuY2Ugb2YgZGVsaWdodCBpbiB0aGUgY29udGludWVkIGFuZCBpbmRlZmF0aWdhYmxlIGdlbmVyYXRpb24gb2Yga25vd2xlZGdlLCBleGNlZWRzIHRoZSBzaG9ydCB2ZWhlbWVuY2Ugb2YgYW55IGNhcm5hbCBwbGVhc3VyZS4='
+local encoded = base64.encode( str )
+local decoded = base64.decode( b64str )
+assert( str == decoded )
+assert( b64str == encoded )
+```
+
+base64.encode( str, encoder = DEFAULT, usecache = false )
+---------------------------------------------------------
+Encodes `str` string using `encoder` table. By default uses table with `+` as
+char for 62, `/` as char for 63 and `=` as padding char. You can specify custom
+encoder. For this you could use `base64.makeencoder`. If you are encoding large
+chunks of text (or another highly redundant data) it's possible to highly
+increase performace (for text approx. x2 gain) by using `usecache = true`. For
+binary data like images using cache decreasing performance.
+
+base64.decode( str, decoder = DEFAULT, usecache = false )
+---------------------------------------------------------
+Decodes `str` string using `decoder` table. Default decoder uses same chars as
+default encoder.
+
+base64.makeencoder( s62 = '+', s63 = '/', spad = '=' )
+------------------------------------------------------
+Make custom encoding table
+
+base64.makedecoder( s62 = '+', s63 = '/', spad = '=' )
+------------------------------------------------------
+Make custom decoding table
+
+Install
+-------
+```bash
+luarocks install base64
+```
diff --git a/Data/BuiltIn/Libraries/lbase64/base64.lua b/Data/BuiltIn/Libraries/lbase64/base64.lua
new file mode 100644
index 0000000..32de332
--- /dev/null
+++ b/Data/BuiltIn/Libraries/lbase64/base64.lua
@@ -0,0 +1,201 @@
+--[[
+
+ base64 -- v1.5.3 public domain Lua base64 encoder/decoder
+ no warranty implied; use at your own risk
+
+ Needs bit32.extract function. If not present it's implemented using BitOp
+ or Lua 5.3 native bit operators. For Lua 5.1 fallbacks to pure Lua
+ implementation inspired by Rici Lake's post:
+ http://ricilake.blogspot.co.uk/2007/10/iterating-bits-in-lua.html
+
+ author: Ilya Kolbin (iskolbin@gmail.com)
+ url: github.com/iskolbin/lbase64
+
+ COMPATIBILITY
+
+ Lua 5.1+, LuaJIT
+
+ LICENSE
+
+ See end of file for license information.
+
+--]]
+
+
+local base64 = {}
+
+local extract = _G.bit32 and _G.bit32.extract -- Lua 5.2/Lua 5.3 in compatibility mode
+if not extract then
+ if _G.bit then -- LuaJIT
+ local shl, shr, band = _G.bit.lshift, _G.bit.rshift, _G.bit.band
+ extract = function( v, from, width )
+ return band( shr( v, from ), shl( 1, width ) - 1 )
+ end
+ elseif _G._VERSION == "Lua 5.1" then
+ extract = function( v, from, width )
+ local w = 0
+ local flag = 2^from
+ for i = 0, width-1 do
+ local flag2 = flag + flag
+ if v % flag2 >= flag then
+ w = w + 2^i
+ end
+ flag = flag2
+ end
+ return w
+ end
+ else -- Lua 5.3+
+ extract = load[[return function( v, from, width )
+ return ( v >> from ) & ((1 << width) - 1)
+ end]]()
+ end
+end
+
+
+function base64.makeencoder( s62, s63, spad )
+ local encoder = {}
+ for b64code, char in pairs{[0]='A','B','C','D','E','F','G','H','I','J',
+ 'K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y',
+ 'Z','a','b','c','d','e','f','g','h','i','j','k','l','m','n',
+ 'o','p','q','r','s','t','u','v','w','x','y','z','0','1','2',
+ '3','4','5','6','7','8','9',s62 or '+',s63 or'/',spad or'='} do
+ encoder[b64code] = char:byte()
+ end
+ return encoder
+end
+
+function base64.makedecoder( s62, s63, spad )
+ local decoder = {}
+ for b64code, charcode in pairs( base64.makeencoder( s62, s63, spad )) do
+ decoder[charcode] = b64code
+ end
+ return decoder
+end
+
+local DEFAULT_ENCODER = base64.makeencoder()
+local DEFAULT_DECODER = base64.makedecoder()
+
+local char, concat = string.char, table.concat
+
+function base64.encode( str, encoder, usecaching )
+ encoder = encoder or DEFAULT_ENCODER
+ local t, k, n = {}, 1, #str
+ local lastn = n % 3
+ local cache = {}
+ for i = 1, n-lastn, 3 do
+ local a, b, c = str:byte( i, i+2 )
+ local v = a*0x10000 + b*0x100 + c
+ local s
+ if usecaching then
+ s = cache[v]
+ if not s then
+ s = char(encoder[extract(v,18,6)], encoder[extract(v,12,6)], encoder[extract(v,6,6)], encoder[extract(v,0,6)])
+ cache[v] = s
+ end
+ else
+ s = char(encoder[extract(v,18,6)], encoder[extract(v,12,6)], encoder[extract(v,6,6)], encoder[extract(v,0,6)])
+ end
+ t[k] = s
+ k = k + 1
+ end
+ if lastn == 2 then
+ local a, b = str:byte( n-1, n )
+ local v = a*0x10000 + b*0x100
+ t[k] = char(encoder[extract(v,18,6)], encoder[extract(v,12,6)], encoder[extract(v,6,6)], encoder[64])
+ elseif lastn == 1 then
+ local v = str:byte( n )*0x10000
+ t[k] = char(encoder[extract(v,18,6)], encoder[extract(v,12,6)], encoder[64], encoder[64])
+ end
+ return concat( t )
+end
+
+function base64.decode( b64, decoder, usecaching )
+ decoder = decoder or DEFAULT_DECODER
+ local pattern = '[^%w%+%/%=]'
+ if decoder then
+ local s62, s63
+ for charcode, b64code in pairs( decoder ) do
+ if b64code == 62 then s62 = charcode
+ elseif b64code == 63 then s63 = charcode
+ end
+ end
+ pattern = ('[^%%w%%%s%%%s%%=]'):format( char(s62), char(s63) )
+ end
+ b64 = b64:gsub( pattern, '' )
+ local cache = usecaching and {}
+ local t, k = {}, 1
+ local n = #b64
+ local padding = b64:sub(-2) == '==' and 2 or b64:sub(-1) == '=' and 1 or 0
+ for i = 1, padding > 0 and n-4 or n, 4 do
+ local a, b, c, d = b64:byte( i, i+3 )
+ local s
+ if usecaching then
+ local v0 = a*0x1000000 + b*0x10000 + c*0x100 + d
+ s = cache[v0]
+ if not s then
+ local v = decoder[a]*0x40000 + decoder[b]*0x1000 + decoder[c]*0x40 + decoder[d]
+ s = char( extract(v,16,8), extract(v,8,8), extract(v,0,8))
+ cache[v0] = s
+ end
+ else
+ local v = decoder[a]*0x40000 + decoder[b]*0x1000 + decoder[c]*0x40 + decoder[d]
+ s = char( extract(v,16,8), extract(v,8,8), extract(v,0,8))
+ end
+ t[k] = s
+ k = k + 1
+ end
+ if padding == 1 then
+ local a, b, c = b64:byte( n-3, n-1 )
+ local v = decoder[a]*0x40000 + decoder[b]*0x1000 + decoder[c]*0x40
+ t[k] = char( extract(v,16,8), extract(v,8,8))
+ elseif padding == 2 then
+ local a, b = b64:byte( n-3, n-2 )
+ local v = decoder[a]*0x40000 + decoder[b]*0x1000
+ t[k] = char( extract(v,16,8))
+ end
+ return concat( t )
+end
+
+return base64
+
+--[[
+------------------------------------------------------------------------------
+This software is available under 2 licenses -- choose whichever you prefer.
+------------------------------------------------------------------------------
+ALTERNATIVE A - MIT License
+Copyright (c) 2018 Ilya Kolbin
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the "Software"), to deal in
+the Software without restriction, including without limitation the rights to
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+of the Software, and to permit persons to whom the Software is furnished to do
+so, subject to the following conditions:
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+------------------------------------------------------------------------------
+ALTERNATIVE B - Public Domain (www.unlicense.org)
+This is free and unencumbered software released into the public domain.
+Anyone is free to copy, modify, publish, use, compile, sell, or distribute this
+software, either in source code form or as a compiled binary, for any purpose,
+commercial or non-commercial, and by any means.
+In jurisdictions that recognize copyright laws, the author or authors of this
+software dedicate any and all copyright interest in the software to the public
+domain. We make this dedication for the benefit of the public at large and to
+the detriment of our heirs and successors. We intend this dedication to be an
+overt act of relinquishment in perpetuity of all present and future rights to
+this software under copyright law.
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+------------------------------------------------------------------------------
+--]]
diff --git a/Data/BuiltIn/Libraries/lbase64/bench.lua b/Data/BuiltIn/Libraries/lbase64/bench.lua
new file mode 100644
index 0000000..d24c1bf
--- /dev/null
+++ b/Data/BuiltIn/Libraries/lbase64/bench.lua
@@ -0,0 +1,76 @@
+local base64 = require'base64'
+local N = 10000000
+local st = {}
+local letters = ' abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890'
+ .. 'абвгдеёжзийклмнопрстуфхцшщчъыьэюя'
+ .. 'АБВГДЕЁЖЗИЙКЛМНОПРСТУФХЦШЩЧЪЫЬЭЮЯ'
+local nletters = #letters
+for i = 1, N do
+ local j = math.random( nletters )
+ st[i] = letters:sub( j, j )
+end
+local s = table.concat( st )
+local t = os.clock()
+local encoded = base64.encode( s )
+local encodetime = os.clock() - t
+
+t = os.clock()
+local decoded = base64.decode( encoded )
+local decodetime = os.clock() - t
+
+assert( s == decoded )
+print('Common text')
+print(('Encoding: %d bytes/sec'):format( math.floor(N/encodetime)))
+print(('Decoding: %d bytes/sec'):format( math.floor(N/decodetime)))
+collectgarbage()
+
+t = os.clock()
+encoded = base64.encode( s, nil, true )
+encodetime = os.clock() - t
+
+t = os.clock()
+decoded = base64.decode( encoded, nil, true )
+assert( s == decoded )
+decodetime = os.clock() - t
+print('Common text (cache)')
+print(('Encoding: %d bytes/sec'):format( math.floor(N/encodetime)))
+print(('Decoding: %d bytes/sec'):format( math.floor(N/decodetime)))
+collectgarbage()
+
+local lt = {}
+for i = 0, 255 do
+ lt[i] = string.char(i)
+end
+nletters = #lt
+for i = 1, N do
+ local j = math.random( nletters )
+ st[i] = lt[j]
+end
+s = table.concat( st )
+
+t = os.clock()
+encoded = base64.encode( s, nil )
+encodetime = os.clock() - t
+
+t = os.clock()
+decoded = base64.decode( encoded )
+decodetime = os.clock() - t
+
+assert( s == decoded )
+print('Binary')
+print(('Encoding: %d bytes/sec'):format( math.floor(N/encodetime)))
+print(('Decoding: %d bytes/sec'):format( math.floor(N/decodetime)))
+collectgarbage()
+
+t = os.clock()
+encoded = base64.encode( s, nil, true )
+encodetime = os.clock() - t
+
+t = os.clock()
+decoded = base64.decode( encoded, nil, true )
+assert( s == decoded )
+decodetime = os.clock() - t
+print('Binary (cache)')
+print(('Encoding: %d bytes/sec'):format( math.floor(N/encodetime)))
+print(('Decoding: %d bytes/sec'):format( math.floor(N/decodetime)))
+collectgarbage()
diff --git a/Data/BuiltIn/Libraries/lbase64/rockspec/base64-1.5-1.rockspec b/Data/BuiltIn/Libraries/lbase64/rockspec/base64-1.5-1.rockspec
new file mode 100644
index 0000000..f25c7b4
--- /dev/null
+++ b/Data/BuiltIn/Libraries/lbase64/rockspec/base64-1.5-1.rockspec
@@ -0,0 +1,20 @@
+package = "base64"
+version = "1.5-1"
+source = {
+ url = "git+https://github.com/iskolbin/lbase64",
+ tag = "v1.5.1",
+}
+description = {
+ summary = "Pure Lua base64 encoder/decoder",
+ detailed = [[
+Pure Lua [base64](https://en.wikipedia.org/wiki/Base64) encoder/decoder. Works with Lua 5.1+ and LuaJIT. Fallbacks to pure Lua bit operations if bit/bit32/native bit operators are not available.]],
+ homepage = "https://github.com/iskolbin/lbase64",
+ license = "MIT/Public Domain"
+}
+dependencies = {}
+build = {
+ type = "builtin",
+ modules = {
+ base64 = "base64.lua",
+ }
+}
diff --git a/Data/BuiltIn/Libraries/lbase64/rockspec/base64-1.5-2.rockspec b/Data/BuiltIn/Libraries/lbase64/rockspec/base64-1.5-2.rockspec
new file mode 100644
index 0000000..7d0addd
--- /dev/null
+++ b/Data/BuiltIn/Libraries/lbase64/rockspec/base64-1.5-2.rockspec
@@ -0,0 +1,20 @@
+package = "base64"
+version = "1.5-2"
+source = {
+ url = "git://github.com/iskolbin/lbase64",
+ tag = "v1.5.2",
+}
+description = {
+ summary = "Pure Lua base64 encoder/decoder",
+ detailed = [[
+Pure Lua [base64](https://en.wikipedia.org/wiki/Base64) encoder/decoder. Works with Lua 5.1+ and LuaJIT. Fallbacks to pure Lua bit operations if bit/bit32/native bit operators are not available.]],
+ homepage = "https://github.com/iskolbin/lbase64",
+ license = "MIT/Public Domain"
+}
+dependencies = {}
+build = {
+ type = "builtin",
+ modules = {
+ base64 = "base64.lua",
+ }
+}
diff --git a/Data/BuiltIn/Libraries/lbase64/rockspec/base64-1.5-3.rockspec b/Data/BuiltIn/Libraries/lbase64/rockspec/base64-1.5-3.rockspec
new file mode 100644
index 0000000..60706d3
--- /dev/null
+++ b/Data/BuiltIn/Libraries/lbase64/rockspec/base64-1.5-3.rockspec
@@ -0,0 +1,20 @@
+package = "base64"
+version = "1.5-3"
+source = {
+ url = "git://github.com/iskolbin/lbase64",
+ tag = "v1.5.3",
+}
+description = {
+ summary = "Pure Lua base64 encoder/decoder",
+ detailed = [[
+Pure Lua base64 encoder/decoder. Works with Lua 5.1+ and LuaJIT. Fallbacks to pure Lua bit operations if bit/bit32/native bit operators are not available.]],
+ homepage = "https://github.com/iskolbin/lbase64",
+ license = "MIT/Public Domain"
+}
+dependencies = {}
+build = {
+ type = "builtin",
+ modules = {
+ base64 = "base64.lua",
+ }
+}
diff --git a/Data/BuiltIn/Libraries/lbase64/test.lua b/Data/BuiltIn/Libraries/lbase64/test.lua
new file mode 100644
index 0000000..d8efebf
--- /dev/null
+++ b/Data/BuiltIn/Libraries/lbase64/test.lua
@@ -0,0 +1,47 @@
+local base64 = require('base64')
+
+local function test( s, b64 )
+ assert( base64.encode( s ) == b64 )
+ assert( base64.decode( b64 ) == s )
+ assert( base64.decode( base64.encode( s )) == s )
+ assert( base64.encode( s, nil, true ) == b64 )
+ assert( base64.decode( b64, nil, true ) == s )
+ assert( base64.decode( base64.encode( s, nil, true ), nil, true ) == s )
+end
+
+test( 'any carnal pleasure.', 'YW55IGNhcm5hbCBwbGVhc3VyZS4=' )
+test( 'any carnal pleasure', 'YW55IGNhcm5hbCBwbGVhc3VyZQ==' )
+test( 'any carnal pleasur', 'YW55IGNhcm5hbCBwbGVhc3Vy' )
+test( 'Man is distinguished, not only by his reason, but by this singular passion from other animals, which is a ' ..
+ 'lust of the mind, that by a perseverance of delight in the continued and indefatigable generation of knowledge, ' ..
+ 'exceeds the short vehemence of any carnal pleasure.', 'TWFuIGlzIGRpc3Rpbmd1aXNoZWQsIG5vdCBvbmx5IGJ5IGhpcyByZWFzb' ..
+ '24sIGJ1dCBieSB0aGlzIHNpbmd1bGFyIHBhc3Npb24gZnJvbSBvdGhlciBhbmltYWxzLCB3aGljaCBpcyBhIGx1c3Qgb2YgdGhlIG1pbmQsIHRoY' ..
+ 'XQgYnkgYSBwZXJzZXZlcmFuY2Ugb2YgZGVsaWdodCBpbiB0aGUgY29udGludWVkIGFuZCBpbmRlZmF0aWdhYmxlIGdlbmVyYXRpb24gb2Yga25vd' ..
+ '2xlZGdlLCBleGNlZWRzIHRoZSBzaG9ydCB2ZWhlbWVuY2Ugb2YgYW55IGNhcm5hbCBwbGVhc3VyZS4=' )
+test( 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et ' ..
+ 'dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea ' ..
+ 'commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat ' ..
+ 'nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit ' ..
+ 'anim id est laborum.', 'TG9yZW0gaXBzdW0gZG9sb3Igc2l0IGFtZXQsIGNvbnNlY3RldHVyIGFkaXBpc2NpbmcgZWxpdCwgc2VkIGRvIGVp' ..
+ 'dXNtb2QgdGVtcG9yIGluY2lkaWR1bnQgdXQgbGFib3JlIGV0IGRvbG9yZSBtYWduYSBhbGlxdWEuIFV0IGVuaW0gYWQgbWluaW0gdmVuaWFtLCBx' ..
+ 'dWlzIG5vc3RydWQgZXhlcmNpdGF0aW9uIHVsbGFtY28gbGFib3JpcyBuaXNpIHV0IGFsaXF1aXAgZXggZWEgY29tbW9kbyBjb25zZXF1YXQuIER1' ..
+ 'aXMgYXV0ZSBpcnVyZSBkb2xvciBpbiByZXByZWhlbmRlcml0IGluIHZvbHVwdGF0ZSB2ZWxpdCBlc3NlIGNpbGx1bSBkb2xvcmUgZXUgZnVnaWF0' ..
+ 'IG51bGxhIHBhcmlhdHVyLiBFeGNlcHRldXIgc2ludCBvY2NhZWNhdCBjdXBpZGF0YXQgbm9uIHByb2lkZW50LCBzdW50IGluIGN1bHBhIHF1aSBv' ..
+ 'ZmZpY2lhIGRlc2VydW50IG1vbGxpdCBhbmltIGlkIGVzdCBsYWJvcnVtLg==')
+test( '«В чащах юга жил бы цитрус? Да, но фальшивый экземпляр!»',
+ 'wqvQkiDRh9Cw0YnQsNGFINGO0LPQsCDQttC40Lsg0LHRiyDR' ..
+ 'htC40YLRgNGD0YE/INCU0LAsINC90L4g0YTQsNC70YzRiNC40LLRi9C5INGN0LrQt9C10LzQv9C70Y/RgCHCuw==')
+test( '«В чащах юга жил бы цитрус? Да, фальшивый экземпляр!»',
+ 'wqvQkiDRh9Cw0YnQsNGFINGO0LPQsCDQttC40Lsg0LHRiyDRhtC' ..
+ '40YLRgNGD0YE/INCU0LAsINGE0LDQu9GM0YjQuNCy0YvQuSDRjdC60LfQtdC80L/Qu9GP0YAhwrs=')
+test( '\137\080\078\071\013\010\026\010\000\000\000\013\073\072\068\082\000\000\000\032\000\000\000\032\001\003\000' ..
+ '\000\000\073\180\232\183\000\000\000\006\080\076\084\069\255\255\255\000\000\000\085\194\211\126\000\000\000\018' ..
+ '\073\068\065\084\008\215\099\248\015\004\196\016\084\006\196\218\011\000\237\189\063\193\243\000\141\059\000\000' ..
+ '\000\000\073\069\078\068\174\066\096\130', 'iVBORw0KGgoAAAANSUhEUgAAACAAAAAgAQMAAABJtOi3AAAABlBMVEX///8AAABVwtN+' ..
+ 'AAAAEklEQVQI12P4DwTEEFQGxNoLAO29P8HzAI07AAAAAElFTkSuQmCC' )
+
+assert( base64.decode('YW55IGNhcm5hbCBwbGVhc3VyZS4=\n\r\\' ) == 'any carnal pleasure.' )
+
+assert( base64.decode('wйqеvнQсуkкiеDнRгhш9щCзwх0ъфYыnвQаsпNрGоFллIдNжGэOё0яLчPQsCDQttC40Lsg0LHRiyDRhtC' ..
+ '40YLRgNGD0YE/INсCмUи0тLьAбsюIЙКNЕG\n\n\n\n\r\rE0LDQu9GM0YjQuNCy0YvQuSDRjdC60LfQtdC80L/Qu9GP0YAhwrs=') ==
+ '«В чащах юга жил бы цитрус? Да, фальшивый экземпляр!»' )