Encryption lua锁盒aes解密
有使用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
如何解密字符串并获取“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)