赞
踩
npm i crypto-js -S
import CryptoJS from 'crypto-js';
/**
* @method encryptPassword 密码加密
* @param password 原始密码
*/
encryptPassword(password: string): string {
let key = "2b7e151628aed2a6abf7158809cf4f3c"
let encrypted = CryptoJS.AES.encrypt(password, key).toString();
return encrypted;
}
/**
* @method decryptPassword 密码解密
* @param password 加密后密码
*/
decryptPassword(password: string): string {
const decrypted = CryptoJS.AES.decrypt(password,this.config.key).toString(CryptoJS.enc.Utf8);
return decrypted;
}
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。