函数:base64_encode BASE64 编码
函数名称:BASE64 编码
函数功能:字符串 BASE64 编码(模式为 ECB)
函数用例
local ts = require("ts")
local msg = "我是重要信息"
local key = "我是秘钥"
local emsg = msg:aes128_encrypt(key)
local emsgb64 = emsg:base64_encode()
dialog(emsgb64)
-- 文件 BASE64 编码
local ts = require("ts")
path = userPath().."/res/test.png"
snapshot(path,0,0,200,200)
function _ReadFileBase64(path)
f = io.open(path,"rb")
if f == null then
return null;
end
bytes = f:read("*all");
f:close();
return bytes:base64_encode();
end
str = _ReadFileBase64(path)