Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/lua/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Encryption lua锁盒aes解密_Encryption_Lua_Aes - Fatal编程技术网

Encryption lua锁盒aes解密

Encryption lua锁盒aes解密,encryption,lua,aes,Encryption,Lua,Aes,有使用lua锁盒库()的AES加密函数 如何解密字符串并获取“lol”字符串?使用ECBMode.Decipher()我试图使用它,但我无法获得原始字符串(“lol”),您是如何使用它的?你看到了吗?是的,我在示例中使用了,我得到了十六进制字符串的解密字符串,但我需要准确地得到原始字符串,而不是十六进制/base64。将asHex替换为asBytes,你将收到字节数组。然后,使用string.char(table.unpack(数组的字节数)) Lockbox = require("lockbo

有使用lua锁盒库()的AES加密函数


如何解密字符串并获取“lol”字符串?

使用
ECBMode.Decipher()我试图使用它,但我无法获得原始字符串(“lol”),您是如何使用它的?你看到了吗?是的,我在示例中使用了,我得到了十六进制字符串的解密字符串,但我需要准确地得到原始字符串,而不是十六进制/base64。将
asHex
替换为
asBytes
,你将收到字节数组。然后,使用
string.char(table.unpack(数组的字节数))
Lockbox = require("lockbox")
Lockbox.ALLOW_INSECURE = true
String = require("string");
Array = require("lockbox.util.array");
Stream = require("lockbox.util.stream");
ECBMode = require("lockbox.cipher.mode.ecb");
ZeroPadding = require("lockbox.padding.zero");
AES128Cipher = require("lockbox.cipher.aes128");
local aes = ECBMode.Cipher();
aes.setKey(Stream.toArray(Stream.fromString("123456789qwertyu")))
aes.setBlockCipher(AES128Cipher)
aes.setPadding(ZeroPadding); 

aes.init() 
aes.update(Stream.fromString("lol"))
aes.finish()
k = aes.asHex()
print(k)