import enc from 'crypto-js/enc';
import AES from 'crypto-js/AES';
// var CryptoJS = require("crypto-js");
var aesDefaultKey="111"
export function aesEnc(plain, sec) {
let usingSec = aesDefaultKey
if (!!sec) {
usingSec = sec
}
let key = enc.Utf8.parse(usingSec);
let srcs = enc.Utf8.parse(plain);
let iv = enc.Utf8.parse(usingSec)
return AES.encrypt(srcs, key, { iv: iv, mode: CryptoJS.mode.CBC, padding: CryptoJS.pad.Pkcs7 }).toString()
}
var str = aesEnc("itadmin5","u90XjGGj1rtmzXzV3Z13")
console.log(str)
console