import CryptoJS from 'crypto-js';
import { Base64 } from 'js-base64';

const a = 'RU5D';
const b = 'ODE';
const c = 'AE';
const d = 'S_K';
const e = 'RVkx';
const z = Base64.decode(a).concat(b, '_', c, d, Base64.decode(e), '6');
const f = 'd3d3';
const g = 'w.e';
const i = 'mru';
const j = 'bik';
const k = 'Y29t';
const n = Base64.decode(f).concat(g, i, j, '.', Base64.decode(k));
const key = CryptoJS.enc.Utf8.parse(z);
const iv = CryptoJS.enc.Utf8.parse(n);
// 解密方法
export function decrypt(word) {
    const stringToEncode = 'Hello, World!'; // 要进行 Base64 编码的字符串
    const encodedString = Base64.encode(stringToEncode); // 进行 Base64 编码
    const decodedString = Base64.decode(encodedString); // 进行 Base64 解码

    let base64 = CryptoJS.enc.Base64.parse(word);
    let src = CryptoJS.enc.Base64.stringify(base64);

    let decrypt = CryptoJS.AES.decrypt(src, key, {
        iv: iv,
        mode: CryptoJS.mode.CBC,
        padding: CryptoJS.pad.Pkcs7,
    });

    let decryptedStr = decrypt.toString(CryptoJS.enc.Utf8);
    return decryptedStr.toString();
}
