问题描述
我正在尝试使用 MCrypt(现已弃用)移植代码:
const pher = new MCrypt("rijndael-128","ecb") // ECB,no IV
function encrypt(rawData,key) {
pher.open(key)
return pher.encrypt(rawData) // Buffer
}
function decrypt(encData,key) {
pher.open(key)
return pher.decrypt(encData) // Buffer
}
使用 cryptian
编码
const {algorithm,mode} = require("cryptian")
const aes128 = new algorithm.Rijndael128()
const cipher = new mode.ecb.Cipher(aes128,null) // TypeError thrown: Value has got incorrect type. Should be Buffer or String.
function encrypt(rawData,key) {
cipher.setKey(key)
return cipher.encrypt(rawData)
}
function decrypt(encData,key) {
cipher.setKey(key)
return cipher.decrypt(encData)
}
我应该如何在 cryptian
模式下使用 ecb
而没有 IV
的 Rijndael128
?
我试图在示例中搜索,但似乎没有找到。
问候
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)