2 回答
TA贡献1155条经验 获得超0个赞
我在@Topaco 的帮助下解决了这个问题。
const key = CryptoJS.enc.Utf8.parse(STORE_KEY);
const iv = CryptoJS.enc.Utf8.parse(STORE_IV);
result = CryptoJS.AES.encrypt(string, key, { iv: key });
result = result.ciphertext.toString();
TA贡献1804条经验 获得超7个赞
这样做:
const crypto = require('crypto')
const STORE_KEY = ''// your key
function aes256 (string) {
let result = ''
const decipher = crypto.createDecipher('aes-256-cbc', STORE_KEY)
result = decipher.update(string, 'hex', 'utf8')
result += decipher.final('utf8')
return result
}
aes256('lalala')
和 SHA256:
let string = '' // your data
let result = crypto.createHmac('SHA256', STORE_KEY).update(string).digest('hex')
添加回答
举报