文件名称:crypto-js 加解密
文件大小:113KB
文件格式:ZIP
更新时间:2020-07-31 14:15:31
crypto-js
window.onload = function () { //需要加密的内容 var C = CryptoJS; var str = C.DES.encrypt(C.enc.Hex.parse('1234567890123456'), C.enc.Hex.parse('1111111111111111'), { mode: C.mode.ECB, padding: C.pad.NoPadding }).ciphertext.toString(); console.log(str) var message = C.enc.Hex.parse('95a8d72813daa94d'); var key = C.enc.Hex.parse('11111111111111111111111111111111'); var iv = C.enc.Hex.parse('0000000000000000'); var str1= C.DES.encrypt(message, key, { iv: iv, mode: C.mode.CBC, padding: C.pad.NoPadding }).ciphertext.toString(); console.log(str1); var str2= C.DES.decrypt(C.lib.CipherParams.create({ ciphertext: C.enc.Hex.parse(str1) }), key, { iv: iv, mode: C.mode.CBC, padding: C.pad.NoPadding }).toString(); console.log(str2) }