1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
| const CryptoJS = require("crypto-js");
const data = { getOutLinkInfoReq: { account: "", linkID: "035Cgf2N6FFR6", passwd: "", caSrt: 0, coSrt: 0, srtDr: 1, bNum: 1, pCaID: "root", eNum: 200, }, }; const r = { a: CryptoJS, };
const i = { a: function getType(t) { const isSymbolSupported = typeof Symbol === "function" && typeof Symbol.iterator === "symbol"; if (isSymbolSupported) { return typeof t; } else { return t && typeof Symbol === "function" && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t; } }, };
var D = CryptoJS.enc.Utf8.parse("PVGDwmcvfs1uV3d1"); function I(e) { var t = r.a.lib.WordArray.random(16), n = ""; if ("string" == typeof e) { var o = r.a.enc.Utf8.parse(e); n = r.a.AES.encrypt(o, D, { iv: t, mode: r.a.mode.CBC, padding: r.a.pad.Pkcs7, }); } else if ("object" == Object(i["a"])(e)) { var a = JSON.stringify(e), s = r.a.enc.Utf8.parse(a); n = r.a.AES.encrypt(s, D, { iv: t, mode: r.a.mode.CBC, padding: r.a.pad.Pkcs7, }); } return r.a.enc.Base64.stringify(t.concat(n.ciphertext)); } const result = I(data); console.log("加密结果", result);
|