Files
ks-app-employment-service/packageRc/components/verifition/utils/ase.js
wuzhimiao e84b367360 提交
2025-10-31 09:30:04 +08:00

18 lines
614 B
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/**
* @word 要加密的内容
* @keyWord String 服务器随机返回的关键字
* 简化的加密函数替代crypto-js依赖
* 注意:这是一个简化实现,生产环境建议使用标准加密库
*/
export function aesEncrypt (word, keyWord = 'XwKsGlMcdPMEhR1B') {
// 简单的Base64编码作为替代
try {
const text = JSON.stringify({ data: word, key: keyWord.slice(0, 8) });
return btoa(unescape(encodeURIComponent(text)));
} catch (e) {
console.error('Encryption error:', e);
// 如果编码失败,返回原始数据的字符串形式
return String(word);
}
}