init version kelfy-mini for new gitea

This commit is contained in:
terry.wang
2025-11-13 13:38:59 +08:00
commit 493fa4f1e1
763 changed files with 55626 additions and 0 deletions

35
config/crypto.js Normal file
View File

@@ -0,0 +1,35 @@
var CryptoJS = require('./crypto-js')
const aecConfig = {
mode: CryptoJS.mode.CBC,
padding: CryptoJS.pad.Pkcs7
}
var key = 'hqe0nb384oyjwnprd386jmslvoyt2io1'
var iv = 'udfe1j8woobdmy51xbz7j4814aw9atdx'
key = CryptoJS.enc.Utf8.parse(key)
iv = CryptoJS.enc.Utf8.parse(iv)
//加密方法
function AES_EN(text) {
const encrypted = CryptoJS.AES.encrypt(text, key, {
iv,
...aecConfig
})
return encrypted.ciphertext.toString()
}
//解密方法
function AES_DE(text) {
text = CryptoJS.enc.Hex.parse(text)
const decrypt = CryptoJS.AES.decrypt({
ciphertext: text
}, key, {
iv,
...aecConfig
})
const decryptedStr = decrypt.toString(CryptoJS.enc.Utf8)
return decryptedStr.toString()
}
export {
AES_EN,
AES_DE
}