ase.js 424 B

123456789101112131415
  1. import CryptoJS from 'crypto-js'
  2. /**
  3. * @word 要加密的内容
  4. * @keyWord String 服务器随机返回的关键字
  5. * */
  6. export function aesEncrypt(word, keyWord = "XwKsGlMcdPMEhR1B") {
  7. var key = CryptoJS.enc.Utf8.parse(keyWord);
  8. var srcs = CryptoJS.enc.Utf8.parse(word);
  9. var encrypted = CryptoJS.AES.encrypt(srcs, key, {
  10. mode: CryptoJS.mode.ECB,
  11. padding: CryptoJS.pad.Pkcs7
  12. });
  13. return encrypted.toString();
  14. }