diff --git a/app/pages/liveRoom/index.client.vue b/app/pages/liveRoom/index.client.vue index 6ad529e..a3ce81f 100644 --- a/app/pages/liveRoom/index.client.vue +++ b/app/pages/liveRoom/index.client.vue @@ -146,53 +146,6 @@ const goBuy = async () => { const tipOpen = () => { message.warning('出价状态未开启') } - -// 加密相关配置 -const cryptConfig = { - password: 'live-skkoql-1239-key', - salt: 'aldk100128ls', - iterations: 10000, - keySize: 32 -} - -// 生成密钥 -const generateKey = (password, salt, iterations, keySize) => { - return CryptoJS.PBKDF2(password, salt, { - keySize: keySize / 4, - iterations: iterations, - hasher: CryptoJS.algo.SHA1 - }).toString(CryptoJS.enc.Hex) -} - -// 解密方法 -const decrypt = (ciphertextBase64, key) => { - const combined = CryptoJS.enc.Base64.parse(ciphertextBase64) - const iv = CryptoJS.lib.WordArray.create(combined.words.slice(0, 4)) - const ciphertext = CryptoJS.lib.WordArray.create(combined.words.slice(4)) - - const decrypted = CryptoJS.AES.decrypt( - {ciphertext: ciphertext}, - CryptoJS.enc.Hex.parse(key), - { - iv: iv, - mode: CryptoJS.mode.CBC, - padding: CryptoJS.pad.Pkcs7 - } - ) - - return decrypted.toString(CryptoJS.enc.Utf8) -} - -// 在需要使用时可以调用的解密函数 -const decryptData = (encryptedData) => { - const keyDerived = generateKey( - cryptConfig.password, - cryptConfig.salt, - cryptConfig.iterations, - cryptConfig.keySize - ) - return decrypt(encryptedData, keyDerived) -}