1121744186 大佬有话说 :
有偿,这段php ase写法换成lua
function encrypt($string, $key) {
$data = openssl_encrypt($string, ‘AES-128-ECB’, $key, 0);
$data = strtolower(bin2hex($data));
return $data;
}
换成 lua 解密,环境 是 宝塔的nginx 和 lua-resty-string
大概写了个 解密不了。。。
local aes = require "resty.aes"
local str = require "resty.string"
— key
local aes_128_cbc_md5 = aes:new("c369d6e2e63fafcfbfb93c9010ce1c9b")
ngx.say("AES 128 CBC (MD5) Decrypted: ", aes_128_cbc_md5:decrypt("6d4c7278633941496230714f673959456339374d6343672b7a3969342b6c56717159704c73356f41366c673d"))
1121744186 大佬有话说 :
1222
TechBlack 大佬有话说 :
本帖最后由 TechBlack 于 2021-2-22 16:58 编辑
AES-128-ECB
aes_128_cbc_md5
这都对不上 你怎么解密:L
local aes = require "resty.aes"
local str = require "resty.string"
local aes_decode = aes:new("c369d6e2e63fafcfbfb93c9010ce1c9b",nil,aes.cipher(128,"ecb"))
function hex2bin(hexstr)
local str = ""
for i = 1, string.len(hexstr) – 1, 2 do
local doublebytestr = string.sub(hexstr, i, i+1);
local n = tonumber(doublebytestr, 16);
if 0 == n then
str = str .. ‘