跳至主要內容
  • Hostloc 空間訪問刷分
  • 售賣場
  • 廣告位
  • 賣站?

4563博客

全新的繁體中文 WordPress 網站
  • 首頁
  • 有偿,这段php ase写法换成lua
未分類
23 2 月 2021

有偿,这段php ase写法换成lua

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 .. ‘0’
      else
            str = str .. string.format("%c", n)
      end
    end
    return str
end

local res =aes_decode:decrypt(hex2bin("6d4c7278633941496230714f673959456339374d6343672b7a3969342b6c56717159704c73356f41366c673d"))

https://cdn.jsdelivr.net/gh/hishis/forum-master/public/images/patch.gif

icy37785 大佬有话说 :

加密方式都不一样,秀了,哈哈哈哈

host5217 大佬有话说 :

AES-128-ECB
aes_128_cbc

1121744186 大佬有话说 :

host5217 大佬有话说 : 2021-2-22 16:50
AES-128-ECB
aes_128_cbc

试了下也是解密不出来,,

1121744186 大佬有话说 :

TechBlack 大佬有话说 : 2021-2-22 16:45
AES-128-ECB
aes_128_cbc_md5
这都对不上 你怎么解密

这个也 解密不了~~ 能不能加个q

h20 大佬有话说 :

ecb是加密后数据不会变动的,cbc有iv所以每次结果都不一样的

TechBlack 大佬有话说 :

1121744186 大佬有话说 : 2021-2-22 17:45
这个也 解密不了~~ 能不能加个q

把hexbin去掉,内容直接放进去

1121744186 大佬有话说 :

TechBlack 大佬有话说 : 2021-2-22 21:03
把hexbin去掉,内容直接放进去

一样的 nil

文章導覽

上一篇文章
下一篇文章

AD

其他操作

  • 登入
  • 訂閱網站內容的資訊提供
  • 訂閱留言的資訊提供
  • WordPress.org 台灣繁體中文

51la

4563博客

全新的繁體中文 WordPress 網站
返回頂端
本站採用 WordPress 建置 | 佈景主題採用 GretaThemes 所設計的 Memory
4563博客
  • Hostloc 空間訪問刷分
  • 售賣場
  • 廣告位
  • 賣站?
在這裡新增小工具