小编zha*_*eny的帖子

如何在javascript中使用CryptoJS

我使用CryptoJS而不是nodejscrypto模块,因为我只使用本机JavaScript,但有些代码不能工作:

function aesEncrypt(text, secKey) {
  const _text = text
  const lv = new Buffer('0102030405060708', 'binary')
  const _secKey = new Buffer(secKey, 'binary')
  const cipher = crypto.createCipheriv('AES-128-CBC', _secKey, lv)
  let encrypted = cipher.update(_text, 'utf8', 'base64')
  encrypted += cipher.final('base64')
  return encrypted
}
Run Code Online (Sandbox Code Playgroud)

那么我应该如何修改这些代码呢?

javascript node.js cryptojs

-2
推荐指数
2
解决办法
2万
查看次数

标签 统计

cryptojs ×1

javascript ×1

node.js ×1