
https://www.bestqa.net/sr/bestqa_util_base64
如果有人需要可以用,这个工具本身没啥特殊的地方。
有没有人需要类似的
输入 加个函数 然后得到一个输出的快速搭建的平台。
背后的代码:
func: encode code: {{{ function encode(params) { if (params.length < 2) return ""; let raw_str = params[0]; if (!raw_str) return ""; let is_encode = params[1]; if (is_encode) { return btoa(raw_str); } else { return atob(raw_str); } } }}} # yes or no text 2. 编码或者解码? type: boolean titleLocation: none labelTrue: 编码 labelFalse: 解码 1. 字符串 type: text textUpdateMode: onTyping 3. 结果 type: expr expr: encode({Q1},{Q2}) 1 echowuhao OP 这个会往后台提交输入,所以私密的内容慎用(默认如此,我增加个配置选项就可以了,还没来得及做) |
3 ai277014717 2020-12-07 12:58:22 +08:00 echo string | base64 -d echo string | base64 |
4 echowuhao OP @yeqizhang 是的,除非自己的内网。这个全是 js 没有必要往后段返回数据。但是主要不是为这个做的,还来得及更改默认配置。 主要是看到 V2EX 站上各种 base64,我想能不能快速弄个小工具。网上也是一大把,主要是探索一下。 对于技术人员,打开 chrome dev console,btoa,atob 就好了。但对于非技术人员,还是有个 UI 好。 我自己有时候也会把一些转换,写成一个 UI 固定下来,方便使用。 |
5 imn1 2020-12-07 13:02:14 +08:00 有没有 lua 的脚本?我想加到 rime,暂时还没时间学 lua |
6 echowuhao OP @ai277014717 看来是做后端的,前段更简单一点。 |
9 echowuhao OP @imn1 https://stackoverflow.com/questions/34618946/lua-base64-encode ```lua local b='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/' -- You will need this for encoding/decoding -- encoding function enc(data) return ((data:gsub('.', function(x) local r,b='',x:byte() for i=8,1,-1 do r=r..(b%2^i-b%2^(i-1)>0 and '1' or '0') end return r; end)..'0000'):gsub('%d%d%d?%d?%d?%d?', function(x) if (#x < 6) then return '' end local c=0 for i=1,6 do c=c+(x:sub(i,i)=='1' and 2^(6-i) or 0) end return b:sub(c+1,c+1) end)..({ '', '==', '=' })[#data%3+1]) end -- decoding function dec(data) data = string.gsub(data, '[^'..b..'=]', '') return (data:gsub('.', function(x) if (x == '=') then return '' end local r,f='',(b:find(x)-1) for i=6,1,-1 do r=r..(f%2^i-f%2^(i-1)>0 and '1' or '0') end return r; end):gsub('%d%d%d?%d?%d?%d?%d?%d?', function(x) if (#x ~= 8) then return '' end local c=0 for i=1,8 do c=c+(x:sub(i,i)=='1' and 2^(8-i) or 0) end return string.char(c) end)) end ``` |
10 xuboying 2020-12-07 13:26:47 +08:00 不是太理解 op 想分享啥,如果 btoa 可以使用,应该分享一个几行以内的页面吧。op 的网站打开要很久很久,好奇打开源码发现海量的 script 引用。。。 是不是过度开发了? |
11 BwNVlwSq 2020-12-07 13:37:02 +08:00 via iPhone Alfred 里有这种插件 |
12 echowuhao OP @xuboying script 是有点多。分享的是快速弄一个小工具。慢的原因 1.script 多,这个确实有待优化。2. 服务器太弱,加之可能你离得远。 核心代码就是几行。UI 耗费一点时间。用 jquery 或者纯 js 从头写最后的代码最少,但是花费时间并不少。 我写这个从构想,到上线,10 分钟够了。 |
13 kkkkkrua 2020-12-07 15:26:35 +08:00 v2ex plus 自带 |
15 echowuhao OP 另外,我不厚道的看了下后台的数据。 大部分 90%的人,是玩的。看的我想笑,上班摸鱼的人真多。 |
16 echowuhao OP 我感觉可以弄几页网页游戏,让你们玩。 |
17 kkkkkrua 2020-12-07 19:04:53 +08:00 |