import CryptoJS from "crypto-js";
// 加密
const KEY = '1234567890123456'
export function crypto(msg) {
    // var key = CryptoJS.enc.Utf8.parse("1463587320654321"); //为了避免补位，直接用16位的秘钥
    // var iv = CryptoJS.enc.Utf8.parse("1758326540123456"); //16位初始向量
    // var encrypted = CryptoJS.AES.encrypt(text, key, {
    //   iv: iv,
    //   mode: CryptoJS.mode.CBC,
    //   padding: CryptoJS.pad.Pkcs7,
    // });
    // return encrypted.toString();
    var keyHex = CryptoJS.enc.Utf8.parse(KEY)
    var option = { mode: CryptoJS.mode.ECB, padding: CryptoJS.pad.Pkcs7 }
    var encrypted = CryptoJS.AES.encrypt(msg, keyHex, option)
  return encrypted.ciphertext.toString()
}