其他分享
首页 > 其他分享> > ctbpsp DES 解密

ctbpsp DES 解密

作者:互联网

地址链接:

分析

对响应的数据分析

全局搜索,调试

有图可以看出:

// npm install crypto-js
var CryptoJS = require("crypto-js");
var C = CryptoJS;
var C_lib = C.lib;
var WordArray = C_lib.WordArray;


function parse1(latin1Str) {
    // Shortcut
    var latin1StrLength = latin1Str.length;
    // Convert
    var words = [];
    for (var i = 0; i < latin1StrLength; i++) {
        words[i >>> 2] |= (latin1Str.charCodeAt(i) & 0xff) << (24 - (i % 4) * 8);
    }
    return new WordArray.init(words, latin1StrLength);
}


var t = '要解密的字符串'
var keyHex = parse1(unescape(encodeURIComponent("ctpstp@custominfo!@#qweASD")))
var ciphertext = CryptoJS.enc.Base64.parse(t)

const decryptDES = (ciphertext) => {
  if (ciphertext) {
      let decrypted = CryptoJS.DES.decrypt(ciphertext, keyHex, {
      mode: CryptoJS.mode.ECB,
      padding: CryptoJS.pad.Pkcs7
    });
    return decrypted.toString(CryptoJS.enc.Utf8);
  } else {
    return '';
  }
};

console.log(decryptDES(t))
结果如图所示

标签:ciphertext,DES,ctbpsp,解密,mode,var,CryptoJS,latin1Str
来源: https://www.cnblogs.com/wyh0923/p/16623113.html