This commit is contained in:
2025-09-08 16:38:08 +08:00
parent be5742d3e3
commit e5591194d3

View File

@@ -0,0 +1,18 @@
import CryptoJS from 'crypto-js'
const key = CryptoJS.enc.Utf8.parse('SQLBot1234567890')
export const encrypted = (str: string) => {
return CryptoJS.AES.encrypt(str, key, {
mode: CryptoJS.mode.ECB,
padding: CryptoJS.pad.Pkcs7,
}).toString()
}
export const decrypted = (str: string) => {
const bytes = CryptoJS.AES.decrypt(str, key, {
mode: CryptoJS.mode.ECB,
padding: CryptoJS.pad.Pkcs7,
})
return bytes.toString(CryptoJS.enc.Utf8)
}