import md5 from "js-md5"; import CryptoJS from "crypto-js"; const _key: string = "99d8b103fea03239"; const getMd5 = (origin: string) => { return md5(origin); }; const encryptForAes = (word: string, originKey: string) => { if (!originKey) { originKey = _key; } const key = CryptoJS.enc.Utf8.parse(originKey); const iv = CryptoJS.enc.Utf8.parse(originKey); const encrypted = CryptoJS.AES.encrypt(word, key, { iv: iv, mode: CryptoJS.mode.CBC, padding: CryptoJS.pad.Pkcs7, }); return encrypted.toString(); }; export { getMd5, encryptForAes };