var message = "systype=android&apptype=62&unit=1&deviceType=2&device=419148109&brand=blackshark&sysversion=9&appversion=8.0.0&appversionCode=800&transactionid=ad1aba9b-26ec-4ba5-a5e3-ecde9ff44255&channel=HuaWeiD&model=DLT-A0&support_channel=HuaWeiD&uid=0"; // var message = $input; var key = CryptoJS.enc.Utf8.parse("1234abcd"); var encryptDes = (message, key) => { var option = { mode: CryptoJS.mode.ECB, padding: CryptoJS.pad.Pkcs7 }; var encrypted = CryptoJS.DES.encrypt(message, key, option); return encrypted.ciphertext.toString() };
// return encryptDes(message,key); //return CryptoJS.enc.Base64.stringify(CryptoJS.enc.Utf8.parse(encryptDes(message,key))); //decrypted.toString(CryptoJS.enc.Utf8) console.log(encryptDes(message,key)); console.log(CryptoJS.enc.Base64.stringify(CryptoJS.enc.Utf8.parse(encryptDes(message,key))));