📅  最后修改于: 2022-03-11 15:01:31.029000             🧑  作者: Mango
import CryptoJS from 'crypto-js'
import AES from 'crypto-js/aes'
const SECRET = 'I am batman'
const plainText = 'This is Sparta!'
export function enc(plainText){
// returns something like this U2FsdGVkX184He5Rp991JYAiCSdTwfZs8T3kJUk3zAc=
// but with random `/` and I dont want that
// I want it to be Hex but .toString(CryptoJs.enc.Hex)
// is not working, it just returns an '' empty string
// it's a string, I checked using typeof
return AES.encrypt(plainText, SECRET).toString();
}