update
init
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
import { JSEncrypt } from 'jsencrypt';
|
||||
// 公钥
|
||||
export const publicKey =
|
||||
'MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCmZfR/bA9X3vp86y1aEpvwzXJYKRRF1fLau2+05/ZtaITLpV8bhkmSf3neSy/Q9gAdvG75Fr73E+GWE+K5b0BpvIS1jDGo319+PpZR39SaZTKZ27XFXrosmJTZutN79t819HS1VseleunHAFgMVufE9U5jP6LGzl/wbkSy01GhzwIDAQAB';
|
||||
/**
|
||||
* @Description:密码加密
|
||||
* @date 2023/8/21
|
||||
* @param password
|
||||
*/
|
||||
|
||||
export function encipher(password): string | undefined {
|
||||
if (password) {
|
||||
// 新建JSEncrypt对象
|
||||
const encryptor = new JSEncrypt();
|
||||
// 设置公钥
|
||||
encryptor.setPublicKey(publicKey);
|
||||
// 加密数据
|
||||
return encryptor.encrypt(password) as string;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user